首頁 > 資料庫 > mysql教程 > MySQL学习足迹记录01--SOURCE,SHOW_MySQL

MySQL学习足迹记录01--SOURCE,SHOW_MySQL

WBOY
發布: 2016-06-01 13:31:37
原創
997 人瀏覽過

bitsCN.com

MySQL学习足迹记录01--SOURCE,SHOW

 

1.导入数据

  command:   SOURCE <PATH> <data.sql>; eg:   mysql> source ~/MyDoc/create.sql;
登入後複製

2.SHOW COLUMNS FROM 的快捷方式为DESCRIBE

  eg:    mysql> SHOW COLUMNS FROM orders;+------------+----------+------+-----+---------+----------------+| Field      | Type     | Null | Key | Default | Extra          |+------------+----------+------+-----+---------+----------------+| order_num  | int(11)  | NO   | PRI | NULL    | auto_increment || order_date | datetime | NO   |     | NULL    |                || cust_id    | int(11)  | NO   | MUL | NULL    |                |+------------+----------+------+-----+---------+----------------+mysql> DESCRIBE orders;+------------+----------+------+-----+---------+----------------+| Field      | Type     | Null | Key | Default | Extra          |+------------+----------+------+-----+---------+----------------+| order_num  | int(11)  | NO   | PRI | NULL    | auto_increment || order_date | datetime | NO   |     | NULL    |                || cust_id    | int(11)  | NO   | MUL | NULL    |                |+------------+----------+------+-----+---------+----------------+
登入後複製

3.显示服务器状态信息

  command:      SHOW STATUS;   eg:     mysql> SHOW STATUS;+------------------------------------------+-------------+| Variable_name                            | Value       |+------------------------------------------+-------------+| Aborted_clients                          | 0           || Aborted_connects                         | 0           | ......... .........
登入後複製

4.显示授予用户

  command:     SHOW GRANTS; eg:   mysql> SHOW GRANTS;+----------------------------------------------------------------------------------------------------------------------------------------+| Grants for root@localhost     ....... .......
登入後複製

5.显示错误信息

  command:     SHOW ERRORS; eg:   mysql> SHOW ERRORS;+-------+------+----------------------------------------------------------------------------------------------------------------------------------------------------+| Level | Code | Message     ....... .......
登入後複製

6.显示警告信息

  command:     SHOW WARMMINGS; eg:   mysql> SHOW WARMMINGS;ERROR 1064 (42000): You have an error in your SQL syntax;  ....... .......
登入後複製

7.显示创建特定数据库的语句

  command:        SHOW CREATE DATABASE <database_name>;   eg:     mysql> SHOW CREATE DATABASE MySQL_ex;+----------+---------------------------------------------------------------------+| Database | Create Database                                                     |+----------+---------------------------------------------------------------------+| MySQL_ex | CREATE DATABASE `MySQL_ex` /*!40100 DEFAULT CHARACTER SET latin1 */ |+----------+---------------------------------------------------------------------+1 row in set (0.00 sec)
登入後複製

8.显示创建特定表格的语句

  command:        SHOW CREATE TABLE <database_name>;   eg:     mysql> SHOW CREATE TABLE orders;+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| Table  | Create Table                                                                                                                                                                                                                                                                                                                                                           |+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+| orders | CREATE TABLE `orders` (  `order_num` int(11) NOT NULL AUTO_INCREMENT,  `order_date` datetime NOT NULL,  `cust_id` int(11) NOT NULL,  PRIMARY KEY (`order_num`),  KEY `fk_orders_customers` (`cust_id`),  CONSTRAINT `fk_orders_customers` FOREIGN KEY (`cust_id`) REFERENCES `customers` (`cust_id`)) ENGINE=InnoDB AUTO_INCREMENT=20010 DEFAULT CHARSET=latin1 | ....
登入後複製

 

 

9.其他SHOW命令

   HELP SHOW;

     

bitsCN.com
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板