MySQL首次安装无法连接
问题
今天刚安装的MySQL数据库,远程无法连接,报错如下
null, message from server: "Host 'xxx.192.223.177' is not allowed to connect to this MySQL server"
解决
- mysql -uroot -p 输入密码
- show databases;
- use mysql;
- select user, host form user;//可以看到user为root,host为localhost的话,说明mysql只允许本机连接,那么外网,本地软件客户端就无法连接了。
- update user set host = '%' where user='root';
- flush privileges;//刷新权限

浙公网安备 33010602011771号