0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SQLSTATE[HY000] [1045] Access denied for user 'test'@'localhost' (using password: YES)の対処

Posted at

自作したログイン機能でログインしようとした時に"SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)"が出てきたのでメモ代わりに投稿します。

#前提:権限を付与するとエラーが出る

 grant all privileges on database_name.* to 'root'@'localhost';

"ERROR 1034 (HY000): Index for table 'db' is corrupt; try to repair it"というエラーが出ました。

#①テーブルを修復

repair table user;

という調子でデータベース内のテーブル全てを修復します。

#②もう一度権限を付与

 grant all privileges on database_name.* to 'root'@'localhost';

これで私の場合はうまくいきました。どなたかのお役に立てると幸いです。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?