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