MySQL常用命令


查看当前使用的数据库,可使用如下命令

#查询数据库中所有表名
mysql> select table_name from information_schema.tables where table_schema='mysql' and table_type='base table';

#查询指定数据库中指定表的所有字段名column_name
mysql> select column_name from information_schema.columns where table_schema='mysql' and table_name='users'

mysql> select database(); #使用函数database()

mysql> show tables; #列头信息中可看出当前使用的db,格式为:Tables_in_[db_name]

mysql> status; #注意结果中的"Current database:"信息

查看系统中有哪些数据库,
mysql> show databases;

更换当前使用的数据库,
mysql> use db_name;

返回当前数据库下的所有表的名...详情


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM