配置外部訪問帳號密碼
本地登錄mysql
Java代碼
mysql -uroot -p
執行
Java代碼
grant all on *.* to rails@'client_ip' identified by 'password' with grant option;
例子:所有局域網客戶端都可訪問
Java代碼
grant all on *.* to root@'192.168.0.%' identified by 'root' with grant option;
例子:為boyu數據庫設置用戶boyu
Java代碼
grant all on boyu.* to boyu@'192.168.0.%' identified by 'p4ssword';
app_server_id為APP應用服務器的IP
設置mysql外部能訪問
/etc/mysql/my.cnf
注釋到下面這行
Java代碼
bind-address = 127.0.0.1
重啟mysql-server
Java代碼
sudo service mysql restart
作者 clark1231