您好,欢迎访问一九零五行业门户网

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

bitscn.com
mysql学习足迹记录01--source,show
1.导入数据
command: source ; 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 ; 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 ; 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
其它类似信息

推荐信息