在搭建MySQL高可用的時候,出現如下問題:
在用MySQL日志中提供的初始登錄密碼登錄失敗,現有免密登錄,方法如下:
1、在/etc/my.cnf中修改
在[mysqld]最后添加:skip-grant-tables
2、重啟MySQL
3、直接mysql進入
4、use mysql;
5、修改賬號密碼:update user set authentication_string=password(“admin12345”) where user=“root”;
6、退出,刪掉/etc/my.cnf的skip-grant-tables
7、重啟
8、用剛才修改的賬號密碼登錄
9、set global validate_password_policy=0;
10、再次修改密碼(不可省略):alter user ‘root’@‘localhost’ identified by ‘12345’;
11、重啟MySQL