0
0

More than 1 year has passed since last update.

MySQL8系 新規作成されるMySQLユーザーの認証プラグインをmysql_native_passwordに変更する

Last updated at Posted at 2022-03-08

概要

  • MySQL8系にて、新規作成されるMySQLユーザーで使用する認証プラグインを「mysql_native_password」に変更する方法をまとめる。

方法

  1. 下記コマンドを実行してMySQLの設定ファイルを作成する。すでに存在している場合も実行して設定ファイルを開く。(設定ファイルの場所は後述する記事を参考にさせていただきました。my.cnfの場所を調べる

    $ sudo vi /etc/my.cnf
    
  2. 開いたファイルの[mysqld]より下の読み込まれる行に下記の内容を追記する。

    /etc/my.cnf
    default_authentication_plugin=mysql_native_password
    
  3. 当該ファイルを保存して閉じ、下記コマンドを実行してMySQLを再起動する。

    $ sudo systemctl restart mysqld
    
  4. 下記コマンドを実行してmusqldの状態を確認する。

    $ systemctl status mysqld.service
    
  5. MySQLにログインして下記SQLを実行して認証プラグインのデフォルト設定が「mysql_native_password」に変更になった事を確認する。

    show variables like 'default_authentication_plugin';
    +-------------------------------+-----------------------+
    | Variable_name                 | Value                 |
    +-------------------------------+-----------------------+
    | default_authentication_plugin | mysql_native_password |
    +-------------------------------+-----------------------+
    
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