Skip to content

Instantly share code, notes, and snippets.

@iitenkida7
Created July 26, 2017 16:13
Show Gist options
  • Save iitenkida7/6179e178a9469c2b51aedfa40f6cdcd9 to your computer and use it in GitHub Desktop.
Save iitenkida7/6179e178a9469c2b51aedfa40f6cdcd9 to your computer and use it in GitHub Desktop.
[MySQL]Create Scheme and User
#[DB作成]一般的な作成方法
CREATE DATABASE @新ユーザー@_db CHARACTER SET utf8;
#[ユーザ作成]ローカル以外からのアクセスが有る場合
grant all privileges on @新ユーザー@_db.* to @新ユーザー@@'%' identified by '@DBパスワード@';
#[ユーザ作成]ローカルアクセスがある場合
grant all privileges on @新ユーザー@_db.* to @新ユーザー@@'localhost' identified by '@DBパスワード@';
#[ユーザ権限]他のテーブルに権限をつける必要がある場合など
grant all privileges on shared .* to @新ユーザー@@'%';
#[反映]
flush privileges;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment