查看mysql数据库表
进入mysql command line client下
查看当前使用的数据库:
mysql>select database(); mysql>status; mysql>show tables; mysql>show databases;//可以查看有哪些数据库,返回数据库名(databasename) mysql>use databasename; //更换当前使用的数据库 mysql>show tables; //返回当前数据库下的所有表的名称
或者也可以直接用以下命令
mysql>show tables from databasename;//databasename可以用show databases得来
mysql查看表结构命令,如下:
desc 表名; show columns from 表名;
describe 表名; show create table 表名;
use information_schema select * from columns where table_name='表名';
rows matched: 1 changed: 0 warnings: 1 mysql> show warnings; +---------+------+-------------------------------------------+ | level | code | message | +---------+------+-------------------------------------------+ | warning | 1265 | data truncated for column 'name' at row 3 | +---------+------+-------------------------------------------+ 1 row in set
以上就是查看mysql数据库表的命令介绍。
mysql清空表
mysql清空表是很重要的操作,也是最常见的操作之一,下面就为您详细介绍mysql清空表的实现方法,希望能够对您有所帮助。
方法1:重建库和表
用mysqldump --no-data把建表sql导出来,然后drop database再create database,执行一下导出的sql文件,把表建上;
方法2:生成清空所有表的sql
mysql -n -s information_schema -e "select concat('truncate table ',table_name,';') from tables where table_schema='eab12'"
输出结果如下:
truncate table authgroupbindings; truncate table authgroups; truncate table authusers; truncate table corpbadcustominfo; truncate table corpsmsblacklisyinfo; truncate table corpsmsfilterinfo; truncate table corpsmsinfo; truncate table eabasereginfos; truncate table eacorpblob; truncate table eacorpinfo; .... ....
这样就更完善了:
以上就是mysql清空表的实现方法。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
小白安装登录mysql-8.0.19-winx64的教程图解(新手必看)
Navicat连接MySQL时报10060、1045错误及my.ini位置问题
网友评论