ここでは、
ユーザー名: user_name
パスワード: user_pass
DB名 : test_db
として例を記載します。
現在接続しているユーザーを確認
select user(), current_user();
ユーザー一覧とホスト名の取得
select user, host, password from mysql.user;
all 権限の付与
grant all on test_db.* to 'user_name'@'%' identified by 'user_pass';
設定されている権限の確認
show grants for 'user_name'@'%';
ユーザー作成
CREATE USER user_name IDENTIFIED BY 'user_pass';
または
CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'user_pass';
強化版