mysql 権限の設定

設定例

権限を設定

grant ALTER, CREATE, DELETE, DROP, INDEX, Select,Update,Insert,Delete ON <DB>.* to '<user>'@'<host>' IDENTIFIED BY '<password>';
grant ALTER, CREATE, DELETE, DROP, INDEX, Select,Update,Insert,Delete ON <DB>.* TO '<name>'@'localhost';
grant ALTER, CREATE, DELETE, DROP, INDEX, Select,Update,Insert,Delete ON <DB>.<table> TO '<name>'@'localhost';

パスワードだけ変更

SET PASSWORD FOR <user>@<host>=password('<password>');

ユーザー確認

select Host, User, Password from mysql.user;

権限確認

show grants for '<user>'@'<host>';
select user,host from  mysql.user;

ユーザー削除

DROP USER <user>;
DELETE FROM mysql.user WHERE user='<user>' AND host='<host>';
FLUSH PRIVILEGES;