最近開始學習MySQL,主要是通過書籍,和看燕十八老師的視頻,然後通過博客記錄自己的學習過程。
登入數據庫
zhiniaobu@telunsu-K55VD:~$ mysql -uroot -p Enter password:查看當前所有數據庫
mysql> show databases;#查看當前所有數據庫 +--------------------+ | Database | +--------------------+ | information_schema | | ceshi | | mysql | | performance_schema | +--------------------+ 4 rows in set (0.04 sec)創建數據庫ceshi1
mysql> create database ceshi1;#創建數據庫ceshi1 Query 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;#刪除數據庫ceshi1 Query 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)