# 1.在`/etc/my.conf`中`[mysqld]`下添加`skip-grant-tables` vim /etc/my.conf
[mysqld] skip-grant-tables
# 2.重启mysql systemctl restart mysqld
# 3.无密码进入mysql mysql -u root
# 4.重置登录密码 USE mysql; SELECT host, user, authentication_string, plugin FROM user; update user set host = '%'where user ='root'; FLUSH PRIVILEGES; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'MyNewPass4!'; FLUSH PRIVILEGES; # 退出 exit
# 5.在`/etc/my.conf`中`[mysqld]`下删除`skip-grant-tables`,添加#号注释 vim /etc/my.conf
[mysqld] #skip-grant-tables
# 6.重启mysql systemctl restart mysqld
# 7.使用新密码进入mysql mysql -u root -p
10、启动失败
1 2 3 4
# 权限问题 chown mysql:mysql -R /var/run/mysqld
/usr/sbin/mysqld --user=mysql &
卸载mysql
1
yum remove mysql-server
1 2 3 4 5
rpm -qa|grep -i mysql
如下: [root@ecs src]# rpm -qa|grep -i mysql mysql80-community-release-el7-3.noarch