Skip to main content

数据库操作

创建数据库

mysql> create database test1;
# Query OK, 1 row affected (0.00 sec)

使用库

mysql> use test1
# Database changed

展示表

mysql> show tables;
# Empty set (0.00 sec)

创建表

mysql> create table employees(id int,name varchar(15));
# Query OK, 0 rows affected (0.04 sec)

插入数据

mysql> insert into employees values(1003,'psj');
# Query OK, 1 row affected (0.01 sec)

修改mysql5.7中的默认字符编码

# my.ini 找到该文件

[mysql]
default-character-set=utf8

[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci