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