轉載時請註明文章出處mysql
服務器上裝了mysql,sql
想在須要在本地用工具鏈接。數據庫
須要開啓root用戶的網絡訪問權限。服務器
首先用服務器本地登陸mysql.網絡
mysql -uroot -pxxxxx //切換至mysql的數據庫 use mysql; select user,host from user;
+-----------+-----------+
| user | host |
+-----------+-----------+
| mysql.sys | localhost |
| root | localhost |
| user1 | localhost |
+-----------+-----------+
3 rows in set (0.00 sec)工具
//咱們能看到root 用戶 後面跟的是localhost 若是須要指定具體的ip,那麼就修改成具體的ip,若是須要開通全部就修改成% update user set host = '%' where user = 'root'; //修改完成退出mysql
+-----------+-----------+
| user | host |
+-----------+-----------+
| root | % |
| mysql.sys | localhost |
| user1 | localhost |
+-----------+-----------+
3 rows in set (0.00 sec)spa
咱們要開啓遠程訪問須要修改bind-address 這一條。3d
新的bind-address是在 /etc/my.cnf目錄下的my.cnf文件裏面rest