接続
mysql db_name -u root -p --no-beep --local-infile
データベース
作業するデータベースの選択
use db_name;
データベース作成
CREATE DATABASE db_name DEFAULT CHARSET utf8;
権限付与
grant all on db_name.* to 'user_name'@'localhost' identified by 'user_password';
grant file on *.* to 'user_name'@'localhost';
テーブル
テーブル作成
mysql> create table posts (
-> id integer NOT NULL AUTO_INCREMENT,
-> name varchar(255),
-> title varchar(255),
-> content text,
-> created_at datetime NOT NULL,
-> updated_at datetime NOT NULL,
-> PRIMARY KEY (id)
-> );
Query OK, 0 rows affected (0.08 sec)
show variables like 'char%';