1
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 5 years have passed since last update.

Mysqlに入ってからAccess deniedやgrantないよが出たら

Last updated at Posted at 2019-11-11

前提

・macユーザーでmysql内でアクセス拒否された、no grantが出て解決策見つからないという方向けの参考メモ。 ・とはいえ、他にも似た記事があるので自分のメモ用という意味合いが強いです。

やり方

1、exitします。
2、以下のコマンドを打ちます。

mysqld_safe --skip-grant-tables &

3、rootユーザーで入ります。

mysql -u root

4、
https://qiita.com/yamateion/items/5509484aaf1a02e9cc57
にある文を打ち込みます...が、権限を全て付与したいときは以下のように打ち込みます。

create user 'user'@'localhost' identified by 'password';
grant all privileges on *.* to 'user'@'localhost';

参考記事との違いは、2文目で*.*としていることです。

追記

2番のコマンドを打ったあと、mysqlのプロセスをkillしておかないと、 mysqld_safe A mysqld process already exists というエラーが出ます。 このエラーが存在していると、2回目以降mysql -uroot で入れなくなります。 よって、
ps aux| grep mysqld

コマンドをうってプロセスID一覧を取得し、一つ一つkillすると良いです。

参考文献

https://qiita.com/yamateion/items/5509484aaf1a02e9cc57 http://www.goofoo.jp/2011/11/1457
1
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
1
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?