Mysql 基本命令

mysql

Mysql基本操作基本命令

1.1 登录

mysql -uroot -p  ******

1.2 显示数据库列表

show databases;

1.3 显示数据库的全部表

 use new_cgpay;

Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changed
mysql> show tables;

1.4 数据库导出

mysqldump  -uroot -p dcat > /home/new-cgpay/dcat.sql

1.5 数据库导入

mysql -uroot -p new_cgpay < /home/new_cgpay/new-cgpay/dcat.sql

1.6 查询

select * from cg_type;

1.7 清空表内容

mysql> truncate cg_type;
Query OK, 0 rows affected (0.01 sec)

1.8 查看表结构

mysql> desc cg_website ;
+-------------+------------------+------+-----+---------+----------------+
| Field       | Type             | Null | Key | Default | Extra         |