1.查看初始密码 grep 'temporary password' /var/log/mysqld.log
修改密码 alteruserroot@localhost identified by 'passwd';
exit;
重新进入
或
update user set authentication_string=password('123456') where user="root";
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
flush priviledges;
2.远程连接
GRANTALLPRIVILEGESON *.* TO'root'@'%' IDENTIFIED BY'password'WITHGRANTOPTION;
FLUSH PRIVILEGES;
service mysqld restart