2018-02-01 centos安装mysql

http://blog.csdn.net/qq_32786873/article/details/78843362

更改密码上面的方法不适用, 用下面的命令:
变更root用户的密码。在mysql环境中,执行update语句:
update mysql.user set authentication_string=password('123qaz') where user='root';
flush privileges;
参见注意事项1,执行成功后,继续执行:flush privileges; exit; 退出mysql。

解决连接不上问题:

Host is not allowed to connect to this MySQL server解决方法

在装有MySQL的机器上登录MySQL mysql -u root -p密码
执行use mysql;
执行update user set host = '%' where user = 'root';这一句执行完可能会报错,不用管它。
执行FLUSH PRIVILEGES;

如果上面还不行, 就关闭防火墙;

你可能感兴趣的:(2018-02-01 centos安装mysql)