1、使用SHOW语句找出在服务器上当前存在什么数据库: mysql SHOW DATABASES; +----------+ | Database | +----------+ | mysql | | test | +----------+ 3 rows in set (0.00 sec) 2、创建一个数据库abccs mysql CREATE DATABASE abccs; 注意不同操作系统对
1、使用SHOW语句找出在服务器上当前存在什么数据库:<ccid_code>mysql> SHOW DATABASES; +----------+ | Database | +----------+ | mysql | | test | +----------+ 3 rows in set (0.00 sec)</ccid_code> Nach dem Login kopieren |
<ccid_code>mysql> CREATE TABLE mytable (name VARCHAR(20), sex CHAR(1), -> birth DATE, birthaddr VARCHAR(20)); Query OK, 0 rows affected (0.00 sec)</ccid_code> Nach dem Login kopieren |
<ccid_code>mysql> SHOW TABLES; +---------------------+ | Tables in menagerie | +---------------------+ | mytables | +---------------------+</ccid_code> Nach dem Login kopieren |
<ccid_code>mysql> DESCRIBE mytable; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | name | varchar(20) | YES | | NULL | | | sex | char(1) | YES | | NULL | | | birth | date | YES | | NULL | | | deathaddr | varchar(20) | YES | | NULL | | +-------------+-------------+------+-----+---------+-------+ 4 rows in set (0.00 sec)</ccid_code> Nach dem Login kopieren |
<ccid_code>mysql> insert into mytable -> values (′abccs′,′f′,′1977-07-07′,′china′); Query OK, 1 row affected (0.05 sec)</ccid_code> Nach dem Login kopieren |
<ccid_code>abccs f 1977-07-07 china mary f 1978-12-12 usa tom m 1970-09-02 usa</ccid_code> Nach dem Login kopieren |