環境
ubuntu 16.04 $ mysql --version mysql Ver 14.14 Distrib 5.7.23, for Linux (x86_64) using EditLine wrapper
Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server - Stack Overflowを参考に、Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL serverエラーの解決を試みたのですが、やはりHost 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL serverエラーが出てしまいます。
どうしたらよいでしょうか。
やったこと
新規ユーザーhogeの作成。grantでlocalhostと%アドレスを追加し、mysqlをrestartしてmysqlを起動している同一の端末からmysql -h [IPアドレス] -u hoge -p
→パスワード:pw
で接続を試みるが、失敗する。
mysql> mysql> CREATE USER 'hoge'@'%' IDENTIFIED BY 'pw'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'hoge'@'%' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> CREATE USER 'hoge'@'localhost' IDENTIFIED BY 'pw'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL PRIVILEGES ON *.* TO 'hoge'@'localhost' WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> select user,host from mysql.user; +------------------+----------------+ | user | host | +------------------+----------------+ | hoge | % | | newuser | % | | user | % | | user | 0.0.0.0 | | user | 192.168.% | | user | 192.168.99.101 | | debian-sys-maint | localhost | | hoge | localhost | | mysql.session | localhost | | mysql.sys | localhost | | newuser | localhost | | root | localhost | | user | localhost | +------------------+----------------+ 13 rows in set (0.00 sec) mysql> ^DBye $ sudo /etc/init.d/mysql restart [ ok ] Restarting mysql (via systemctl): mysql.service. $ mysql -h 192.168.99.1 -u hoge -p Enter password: ERROR 1130 (HY000): Host '192.168.99.101' is not allowed to connect to this MySQL server
回答1件
あなたの回答
tips
プレビュー