1、查看日志文件中默认root账号的密码:
shell> sudo grep 'temporary password' /var/log/mysqld.log
shell> mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
2、设置Mysql远程访问
登陆mysql:
mysql -u root -p
使用mysql库:
use mysql;
查看用户表:
select host, user from user;
更新用户表:
update user set host = '%' where user = 'root';
强制刷新权限:
flush privileges;