今回、formというデータベースに、以下の様なusers_infoというテーブルを作りたい。
[table name : user_info] name password u1 u1
MySQLを起動
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | bookshelf | | form | | mysql | | performance_schema | | test | | wordpress | +--------------------+ 7 rows in set (0.00 sec) mysql> use form Database changed mysql> show tables; Empty set (0.00 sec) mysql> create table user_info(name varchar(20), password varchar(20)); Query OK, 0 rows affected (0.03 sec) mysql> show tables -> ; +----------------+ | Tables_in_form | +----------------+ | user_info | +----------------+ 1 row in set (0.00 sec) mysql> select * from user_info -> ; Empty set (0.00 sec) mysql> show columns from user_info; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | name | varchar(20) | YES | | NULL | | | password | varchar(20) | YES | | NULL | | +----------+-------------+------+-----+---------+-------+ 2 rows in set (0.00 sec) mysql> insert into user_info(name,password) values('u1','u1'); Query OK, 1 row affected (0.00 sec) mysql> select * from user_info -> ; +------+----------+ | name | password | +------+----------+ | u1 | u1 | +------+----------+ 1 row in set (0.00 sec)