1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQL User 作成(簡易)

Last updated at Posted at 2013-11-07

メモ

dbun=user
dbup=userpassword
dbnm=databasename

dbmn=root
dbmp=rootpassword

dbch=UTF8

mysqladmin -u $dbmn -p$dbmp --default-character-set=$dbch  create $dbnm
mysql      -u $dbmn -p$dbmp mysql --default-character-set=$dbch -e "GRANT ALL ON $dbnm.* TO $dbun@localhost IDENTIFIED BY '$dbup'"
mysql      -u $dbmn -p$dbmp mysql --default-character-set=$dbch -e "SELECT User, Host from mysql.user where User = '$dbun'"
mysqladmin -u $dbmn -p$dbmp flush-privileges
mysql      -u $dbun -p$dbup $dbnm -e "select 1"
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?