ファイアウォールでやらかす
まず最初のエラー。下記コマンドを試みる。1 2 | C:\Users\>mysql -u <MySQLのユーザ> -h '<DBサーバIP>' -p Enter password: ********* |
1 | ERROR 2003 (HY000): Can 't connect to MySQL server on ' <クライアントIP>' (10060) |
1 | iptables -L |
INPUTチェインでREJECTしているルールがあったので削除。
(本来はダメだろうけど、とりあえず問題を切り分ける為に実施)
my.cnf でやらかす
再度接続を試みると、1 | ERROR 1042 (HY000): Can't get hostname for your address |
MySQLの設定ファイル my.cnf に下記を追加すれば良いらしい。
1 | skip-name-resolve |
1 2 3 4 | [mysqld] (略) skip-name-resolve (略) |
権限でやらかす
再度接続を試みると、1 | ERROR 1130 (HY000): Host '<クライアントIP>' is not allowed to connect to this MySQL server |
ログインを試みているユーザに、クライアントPCからアクセスする権限を付与しないといけないらしい。
1 | GRANT ALL PRIVILEGES ON *.* TO <MySQLユーザ>@ '<クライアントIP>' IDENTIFIED BY '<パスワード>' WITH GRANT OPTION ; |
1 2 3 4 5 6 7 8 9 10 11 12 13 | Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.5.10 MySQL Community Server (GPL) Copyright (c) 2000, 2014, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and /or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> |
【参考】
MySQLで外部から接続するときにチェックする項目 - yummy-yummyMySQL を外部接続できるようにする - 怠惰な日々
Linuxコマンド集 - 【iptables】パケットフィルタリングを設定する:ITpro
0 件のコメント:
コメントを投稿