mysql設置遠程訪問
修改本機配置
註釋掉在/etc/mysql/mysql.conf.d/mysqld.cnf裏面的bind-address = 127.0.0.1
#By default we only accept connections from localhost
#bind-address = 127.0.0.1
修改爲
bind-address = 127.0.0.1
重啓mysql服務 service mysql restart
添加用戶
在mysql中添加遠程訪問用戶
格式:grant 權限 on 數據庫教程名.表名 to 用戶@登錄主機 identified by “用戶密碼”;
use mysql;
Grant all on *.* to 'root'@'%' identified by 'root用戶的密碼' with grant option;
flush privileges;
示例:
grant all privileges 'rushuo'.* to 'rushuo'@'%' identified by 'rushuo';
flush privileges;