Colinuxに浮かせているMySqlにリモートから繋ぎたくなったのでやり方を調べてみた。
MySqlのバージョンによってかなり手順が違ったり難航したのでメモ。
今回は以下のバージョンでやってます。
サーバー側での設定
1、接続するユーザーに全ホストからの接続権限を付与する。*1
mysql>GRANT ALL PRIVILEGES ON *.* TO user@"%";
2、my.cnfよりbind-address制限を削除。
/etc/mysql/my.cnfを編集し以下の行をコメントアウト。。
bind-address = 127.0.0.1
3、Mysqlを再起動。
#mysqladmin -u root shutdown #mysqld_safe &
クライアントより接続。
こんな感じで接続できた。
C:\>mysql -u user -h [ホスト名] Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.0.22-Debian_0ubuntu6.06.10-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
*1:%は全ホストという意味。個別に指定しても良い