在未登陆的状态下查询
mysql -V;
或者
mysql --version;
mysql Ver 14.14 Distrib 5.5.61, for Win64 (AMD64)
已登录状态下查询
select version();
+-----------+
| version() |
+-----------+
| 5.5.61 |
+-----------+
展示数据库
show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
使用数据库
use mysql;
Database changed
查看表格
show tables from mysql;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
描述一个表
desc db;#desc是descripte的缩写
退出
exit