Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What are the problem?
@narupo

MySQL5.5 - ユーザーの作成周り

ユーザーの確認

ユーザー名、ホスト名、ハッシュ化されたパスワードの列挙。

SELECT user, host, password FROM mysql.user;

passwordが合っているか確認したい場合は以下のSQLで上のハッシュと見比べる。

SELECT PASSWORD('password');

ユーザーの作成

ホスト名を省略すると%になる。

CREATE USER username IDENTIFIED BY 'password'; 
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; 

ユーザーのパスワードを変更

SET PASSWORD FOR 'username'@'localhost' = PASSWORD('password');

ユーザーの削除

DROP USER username FROM mysql.user;
DROP USER 'username'@'localhost' FROM mysql.user;

ユーザーに権限を付与

データベースmydbの全てのテーブルに対する全ての権限をmyuser@localhostに付与。

GRANT ALL ON mydb.* TO 'myuser'@'localhost';
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
0
Help us understand the problem. What are the problem?