LoginSignup
0
0

More than 1 year has passed since last update.

mysql8.0

Last updated at Posted at 2021-11-10

ubuntuでインストール

sudo apt install mysql-server

パスワード初期化など

sudo mysql-secure-installation

ログイン

sudo mysql -u root -p

sudoが必要なので注意

ユーザー作成

create user 'tomoya'@'localhost' identified by 'Password1!';
create user 'tomoya'@'%' identified by 'Password1!';

権限付与

grant all on *.* to 'tomoya'@'localhost' with grant option;
grant all on *.* to 'tomoya'@'%' with grant option;

allはすべての権限を意味している。はじめの*はデータベース、次の*はテーブルを意味している。
%は外部サーバーからの権限行使の許可を意味している。

認証プラグインの確認

select user,host,plugin from mysql.user;

デフォルトで認証プラグインはcaching_sha2_passwordになっているので変更する

認証プラグインの変更

alter user 'tomoya'@'localhost' identified with mysql_native_password by 'Password1!';
alter user 'tomoya'@'%' identified with mysql_native_password by 'Password1!';
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