记MySQL密码
MySQL 5.7.5 版本及以前
[root@mysql1 ~]# vim /etc/my.cnf
[mysqld]
skip-grant-tables
[root@mysql1 ~]# service mysqld restart
[root@mysql1 ~]# mysql
mysql> update mysql.user set password=password("456") where user="root" and host="localhost";
mysql> flush privileges;
mysql> \q
[root@mysql1 ~]# vim /etc/my.cnf
[mysqld]
skip-grant-table
[root@mysql1 ~]# service mysqld restart
MySQL 5.7.6 版本及以后:
[root@slave1 ~]# vim /etc/my.cnf
[mysqld]
skip-grant-tables
[root@slave1 ~]# systemctl restart mysqld

[root@slave1 ~]# vim /etc/my.cnf
[root@slave1 ~]# systemctl restart mysqld
网友评论