Mysql当中一些常用的操作

1、查看mysql当中有哪些库

show databases;

2、进入某个库

use 库名;

3、查看库当中有几个表

在2的基础上:show tables;

4、查看表结构

desc 表名;

5、备份数据库表

mysqldump –h*.*.*.*  –uroot –p 数据库名 表名 > /tmp/20180620bk.sql

如果只需要备份数据库表名去掉即可

6、还原数据库表

mysql –h*.*.*.*  -uroot -p -Dglb0database_ngb 数据库名 </tmp/20180620bk.sql

如果还原全库数据则把数据库名去掉即可

7、删除某条记录

delete from 表名 where 条件

猜你喜欢

转载自blog.csdn.net/huangzx3/article/details/80737974