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.

【MySQL】mysqlのrootユーザーがsudo無しでログインできるようにする

Posted at

rootはセキュリティのためにsudoでログインするように設定していることが多いですが、ローカル環境でrootアカウントでデータベースに接続したかったため、sudo無しでrootログインできるようにした過程をメモ。
mysqlのバーションによって違いが出たので、注意。

mysqlにsudoでログイン

sudo mysql -u root -p

設定し直す

mysql > ALTER USER 'root'@'localhost' identified BY '[パスワード]';
mysql >FLUSH PRIVILEGES;

※設定し直す(MYSQL5.7まで有効なコマンド)


ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[パスワード]';
mysql >FLUSH PRIVILEGES;
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?