-- 查看当前数据库
mysql> SELECT DATABASE();+------------+| DATABASE() |+------------+| mydb |+------------+1 row in set (0.00 sec)
-- 显示当前时间、用户名、数据库版本
mysql> SELECT now(), user(), version();+---------------------+----------------+-----------+| now() | user() | version() |+---------------------+----------------+-----------+| 2019-01-03 15:54:47 | root@localhost | 5.7.24 |+---------------------+----------------+-----------+1 row in set (0.00 sec)
-- 查看已有库
mysql> SHOW DATABASES;+--------------------+| Database |+--------------------+| information_schema || mydb || mysql || performance_schema || sys |+--------------------+5 rows in set (0.00 sec)
-- 查看当前库信息
mysql> SHOW CREATE DATABASE mydb;+----------+-----------------------------------------------------------------+| Database | Create Database |+----------+-----------------------------------------------------------------+| mydb | CREATE DATABASE `mydb` /*!40100 DEFAULT CHARACTER SET latin1 */ |+----------+-----------------------------------------------------------------+1 row in set (0.00 sec)
-- 删除库
mysql> drop database mytest;Query OK, 0 rows affected (0.00 sec)
启动方式一:
mysqld_safe --secure-file-priv= --user=mysql &
启动方式二:
/etc/init.d/mysqld start
/etc/init.d/mysqld stop启动方式三:
service mysqld start
service mysqld stop