sudo vi /etc/mysql/my.cnfmysql
找到bind-address = 127.0.0.1sql
注释掉这行:#bind-address = 127.0.0.1ide
或者改成: bind-address = 0.0.0.0 (容许任意IP访问)spa
或者本身指定一个IP地址。rest
mysql -h localhost -uroot -pget
Grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;it
flush privileges;io
sudo /etc/init.d/mysql restartword