1. 程式人生 > >連線遠端伺服器Linux的MySql

連線遠端伺服器Linux的MySql

MySql預設是禁止外部訪問的,需要按如下修改:

1. 登入 MySql

mysql -u root -p

2. 然後輸入(password填寫自己的)

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

3. 我的系統是Ubuntu 16.04 ,MySql 5.7

開啟檔案

nano /etc/mysql/mysql.conf

然後發現有一行顯示

bind-address  = 127.0.0.1

用‘#’註釋掉

#bind-address = 127.0.0.1

完事

參考(https://stackoverflow.com/questions/14779104/how-to-allow-remote-connection-to-mysql)