LoginSignup
0
0

More than 3 years have passed since last update.

MySQLでログインができない

Posted at

結論

ユーザー名のホストの記載方法が間違っていた
全ホストからのアクセスを許可する記載方法は「%」

【誤用】
test@*
【正解】
test@%

修正

もとのログイン名を確認

>SELECT user, host FROM mysql.user;
+---------------+-----------+ 
| user          | host      | 
+---------------+-----------+ 
| test          | *         |
>drop user 'test'@'*';
>create user 'test'@'%' identified by 'password';
>grant all privileges on *.* to test@'%' identified by 'password';

確認

ユーザーが追加されているか確認

>SELECT user, host FROM mysql.user;
+---------------+-----------+ 
| user          | host      | 
+---------------+-----------+ 
| test          | %         |

ログインを確認

>mysql -u test -ppassword -h 192.168.1.xxx
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0