Exit Database: Exit
mysql> exit
Cancel command : ctrl + c
Display of currently connected users : select user ();
MySQL> SELECT User ();
+ ---------------- +
| User () |
+ ---------------- +
| the root @localhost | # the current user is the root user + ---------------- + 1 Row in the SET (0.00 sec)
mysql>
View database service basic information : status;
--------------
mysql Ver 14.14 Distrib 5.7.24, for linux-glibc2.12 (x86_64) using EditLine wrapper
Connection ID: 2 # ID number of the connection
Current Database: # currently used database, there is no access to any database
Current user: root @ localhost user # connected to the root
the SSL: Not in use
Current pager: stdout
the Using outfile: ''
DELIMITER the using:;
Server version: 5.7.24 MySQL Community Community Server (the GPL) # version with the version MYSQL5.7.24
Protocol version: 10
connection: Localhost Via UNIX socket # connection
Server CharacterSet: latin1
Db CharacterSet: latin1
CharacterSet Client: UTF8 # characters
Conn CharacterSet:. UTF8
the UNIX Socket: /tmp/mysql.sock #sock file location
The Uptime: 40 min 37 [sec # start time
Threads: 1 Questions: 7 Slow queries: 0 Opens: 105 Flush tables: 1 Open tables: 98 Queries per second avg: 0.002
--------------
Where there is some view the current server database: Show Databases;
MySQL> Show Databases;
+ -------------------- +
| Database |
+ ------------------- - +
| information_schema |
| MySQL |
| performance_schema |
| SYS |
+ -------------------- +
4 rows in the SET (0.08 sec) # 4 expressed 4 library, a library is a directory
View the data in the database table: use mysql
mysql> use sys
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed #此时已在sys数据库中
mysql> select databases(); #查看sys数据库中的信息
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'databases()' at line 1
mysql> select database();
+------------+
| database() |
+------------+
| sys |
+------------+
1 row in set (0.00 sec)