Skip to content

Instantly share code, notes, and snippets.

@lxyuma
Last active December 12, 2015 10:29
Show Gist options
  • Select an option

  • Save lxyuma/4759952 to your computer and use it in GitHub Desktop.

Select an option

Save lxyuma/4759952 to your computer and use it in GitHub Desktop.
mysql user command

よく忘れてしまうので、mysqlのuser系のコマンドのまとめ

  • ユーザー作成

  • create user 'username'@'host'

  • ユーザー変更

  • rename user old to new

  • ユーザー一覧

  • select Host,User from mysql.user;

  • 権限確認

  • show grants for 'user'@'localhost'; // pw なし

  • grant all privileges on database.* to 'root'@'localhost' identified by 'password';

  • with grant optionつけると管理者権限

  • 権限付与

  • GRANT 権限 ON db_name.* TO user;

  • ※ 権限=ALL/select/create/update等

  • 権限削除

  • revoke all on isucon.* from 'root'@'localhost';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment