mysql navicat : 2003 can't connect to MySQL server on 'localhost'(10038).

使用nacicat 工具 ,主机连接虚拟机
2003 can’t connect to MySQL server on ‘localhost’(10038).

sudo apt-get install mysql-server
mysql -h 127.0.0.1 -P 3306 -uroot -p123456
show databases;


#服务管理
#启动
sudo service mysql start
#停止
sudo service mysql stop
#服务状态
sudo service mysql status



sudo vim /etc/mysql/mysql.conf.d/mysqld/cnf
bind-address = 127.0.0.1 -----> 0.0.0.0

mysql -h 127.0.0.1 -P 3306 -uroot -p123456
use mysql;
grant all privileges on *.* to 'root'@'%' identifide by '123456';
flush privileges;


#重启
sudo service mysql restart

猜你喜欢

转载自blog.csdn.net/sunt2018/article/details/84136498