コマンドラインから、MySQL のデータベースを作成するためのメモです。普段あまりやらないのでよく忘れます。
まず、データベース作成 utf8 でつくります。utf-8 とか書くと文句言われます。
create database hoge default character set utf8;
このデータベース用に一緒にユーザをつくることもできます。identified
GRANT 権限 ON DB名.テーブル名 TO ユーザ名 INDENTIFIED BY 'パスワード'
具体的には、
grant all privileges on hoge.* to hoge_test identified by 'hogepassword'
ユーザのみ作る場合こともできますけど、データベースと一緒ユーザは作ったほうが楽です。
insert into user(host,user,password) values('localhost','hoge_test',password('dummyPass');