首先,我们需要通过以下命令来检查MySQL服务器是否启动:
ps -ef | grep mysqld
如果MySql已经启动,以上命令将输出mysql进程列表, 如果mysql未启动,你可以使用以下命令来启动mysql服务器:
mysql -u root -p
123456
进入或退出MySQL 服务器, 你可以执行以下命令:
root@localhost> show database;
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 'database' at line 1
root@localhost> show databases; |
---|
Database |
information_schema |
mysql |
performance_schema |
sys |
4 rows in set (0.00 sec)
root@localhost> use mysql;
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
root@localhost> ^C
root@localhost> exit