时间:2021-07-01 10:21:17 帮助过:11人阅读
登入数据库
zhiniaobu@telunsu-K55VD:~$ mysql -uroot -pEnter password:查看当前所有数据库
mysql> show databases;#查看当前所有数据库+--------------------+| Database |+--------------------+| information_schema || ceshi|| mysql|| performance_schema |+--------------------+4 rows in set (0.04 sec)创建数据库ceshi1
mysql> create database ceshi1;#创建数据库ceshi1Query OK, 1 row affected (0.00 sec)mysql> show databases;#查看当前所有数据库,会看到现在多了一个ceshi1+--------------------+| Database |+--------------------+| information_schema || ceshi|| ceshi1 || mysql|| performance_schema |+--------------------+5 rows in set (0.00 sec)查看数据库ceshi1的定义
mysql> show create database ceshi1;#查看数据库ceshi1的定义+----------+-------------------------------------------------------------------+| Database | Create Database |+----------+-------------------------------------------------------------------+| ceshi1 | CREATE DATABASE `ceshi1` /*!40100 DEFAULT CHARACTER SET latin1 */ |+----------+-------------------------------------------------------------------+1 row in set (0.00 sec)删除数据库ceshi1
mysql> drop database ceshi1;#删除数据库ceshi1Query OK, 0 rows affected (0.07 sec)mysql> show databases;#查看当前所有数据库,现在会发现ceshi1已经不存在了,因为已经删除了+--------------------+| Database |+--------------------+| information_schema || ceshi|| mysql|| performance_schema |+--------------------+4 rows in set (0.00 sec)