備忘録 |
---|
select User, Host, Password from mysql.user;
create user '<user_name>'@'localhost' identified by '<password>' ; → <password> は、パスワードポリシーに準ずる grant all privileges on `<db_prefix>_%`.* to '<user_name>'@'localhost' ; → 「`<db_prefix>_%`.* to」にて、指定プレフィックスのDBすべてが対象となる
デフォルトのパスワードポリシー ・パスワード長 8文字以上 ・大文字小文字 1文字以上 ・数字 1文字以上 ・記号 1文字以上
GRANT ALL PRIVILEGES ON *.* TO hoge_user@'localhost' IDENTIFIED BY '<PASSWORD>' WITH GRANT OPTION; flush privileges;
GRANT ALL PRIVILEGES ON <DB_NAME>.* TO hoge_user@'localhost' IDENTIFIED BY '<PASSWORD>' WITH GRANT OPTION; flush privileges;
GRANT ALL PRIVILEGES ON *.* TO hoge_user@'localhost' IDENTIFIED BY '<PASSWORD>'; flush privileges;
GRANT ALL PRIVILEGES ON <DB_NAME>.* TO hoge_user@'localhost' IDENTIFIED BY '<PASSWORD>'; flush privileges;
show grants for hoge_user@'localhost';
GRANT all ON hoge_db.* TO hoge_user@'localhost' IDENTIFIED BY '<PASSWORD>'; flush privileges;
REVOKE ALL ON hoge_db.* FROM hoge_user@'localhost'; flush privileges;
ALTER USER '<user_name>@'localhost' identified BY '<password>' ;
SET PASSWORD FOR hoge_user@'localhost'=PASSWORD('<PASSWORD>');