1、停止mysql
systemctl stop mysqld
2、启动无权限表的mysql服务:
mysqld_safe --skip-grant-tables &
3、升级过数据库的执行这个步骤
mysql_upgrade -u root
ss -lntup | grep 3306
pid 1647
kill -TERM 1647
4、mysqld_safe --skip-grant-tables &
5、mysql -u root
6、FLUSH PRIVILEGES;
7、SET PASSWORD FOR ‘root’@‘localhost’ = PASSWORD(‘new_password’);
8、ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘new_password’;
9、EXIT;
10、
[root@centos7 ~]# ss -lntup | grep 3306
tcp LISTEN 0 50 *:3306 *:* users:(("mysqld",pid=1647,fd=14))
[root@centos7 ~]# kill -TERM 1647
11、
systemctl start mariadb