?
This document uses PHP Chinese website manual Release
show databases;
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | app_blogcurder | | auth_demo | | canzhieps | | cmsdemo | | mysql | | onethink | | performance_schema | | ranzhi | | thinkems | | thinksns_3_1 | | thinksns_4_0 | +--------------------+ 12 rows in set (0.01 sec)
create database 庫(kù)名字;
mysql> create database test; Query OK, 1 row affected (0.00 sec)
drop database [IF EXISTS] 庫(kù)名字;
mysql> drop database test; Query OK, 0 rows affected (0.01 sec)
use 庫(kù)名;
mysql> use mysql Database changed mysql> \s -------------- mysql Ver 14.14 Distrib 5.6.17, for Win64 (x86_64) Connection id: 8 Current database: mysql Current user: root@localhost SSL: Not in use Using delimiter: ; Server version: 5.6.17 MySQL Community Server (GPL)
show tables;[需要縣選中數(shù)據(jù)庫(kù)]
mysql> use mysql Database changed mysql> show tables; +---------------------------+ | Tables_in_mysql | +---------------------------+ | columns_priv | | db | | event | | func | | general_log | ... ...
desc 表名; 或者 describe 表名;
mysql> desc db; +-----------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------------+---------------+------+-----+---------+-------+ | Host | char(60) | NO | PRI | | | | Db | char(64) | NO | PRI | | | | User | char(16) | NO | PRI | | | ... ...
CREATE TABLE `member` ( `uid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '用戶ID', `nickname` char(16) NOT NULL DEFAULT '' COMMENT '昵稱', `sex` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '性別', `birthday` date NOT NULL DEFAULT '0000-00-00' COMMENT '生日', `qq` char(10) NOT NULL DEFAULT '' COMMENT 'qq號(hào)', `score` mediumint(8) NOT NULL DEFAULT '0' COMMENT '用戶積分', `login` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '登錄次數(shù)', `reg_ip` bigint(20) NOT NULL DEFAULT '0' COMMENT '注冊(cè)IP', `reg_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '注冊(cè)時(shí)間', `last_login_ip` bigint(20) NOT NULL DEFAULT '0' COMMENT '最后登錄IP', `last_login_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后登錄時(shí)間', `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '會(huì)員狀態(tài)', PRIMARY KEY (`uid`), KEY `status` (`status`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='會(huì)員表';
drop table 表名;