MySQLへ192.168.1.xxxからアクセス可能にする | Subaru's Husband

Subaru's Husband

python、linux、バイクなんかのネタを書きます。
一応security業界でご飯を食べてます。
備忘録がメインだと思うので、未来の自分が助かれば最高。

【"test"ユーザーが192.168.1.xxxから任意のDBに接続できように設定】

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| debian-sys-maint | localhost |
| test | localhost |
+------------------+-----------+
2 rows in set (0.02 sec)

>grant all privileges on データベース名.* to test@"192.168.1.%" identified by 'パスワード' with grant option ;

【my.cnfの変更】

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1 ← コメントアウト