mysql 5.7 2003 cant connect to mysql server on 10061 unknown error
mysql 5.7 2003 cant connect to mysql server on 10061 unknown error
navicat for mysql 远程连接数据库时出现2003-Can’t connect to Mysql on ‘主机名’(10061)解决方法
授权远程连接mysql方法:
grant all privileges on *.* to '用户名' identified by '密码';
flush privileges;
如果你用的是mysql8,那么需要创建新用户进行授权,直接用root授权报错;
因此需要修改mysql配置文件
步骤:
cat /etc/mysql/my.cnf
输出以下:
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
所以进入/etc/mysql/mysql.conf.d/ 修改
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
(3)将bind-address = 127.0.0.1修改为bind-address = 0.0.0.0
(4)保存退出
(5)sudo service mysql restart
(一定要重启数据库,不然没用)
ok,此时就可以远程连接此数据库了.