创建数据库
- 创建数据库
mysql> create database test_db;
- 查看所有数据库
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sakila |
| sys |
| test_db |
| world |
+--------------------+
7 rows in set (0.00 sec)
- 查看创建的数据库的状态
mysql> show create database test_db\g
+----------+------------------------------------------------------------------------------------------------+
| Database | Create Database |
+----------+------------------------------------------------------------------------------------------------+
| test_db | CREATE DATABASE `test_db` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ |
+----------+------------------------------------------------------------------------------------------------+
- 选择创建表的数据库
mysql> use test_db;
Database changed
- 创建tb_emp1 表
mysql> create table tb_emp1(
-> id INT(11),