1、创建数据库
CREATE DATABASE IF NOT EXISTS database_name;
CREATE DATABASE [IF NOT EXISTS] database_name DEFAULT CHARACTER SET character_name COLLATE collate_name [DEFAULT ENCRYPTION='N'];
CREATE DATABASE IF NOT EXISTS test_character DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT ENCRYPTION='N';
2、查看数据库创建信息
SHOW CREATE DATABASE database_name;
SHOW CREATE DATABASE goods \G
3、查看数据库使用编码
SHOW VARIABLES LIKE '%character_set_database%';
4、修改数据库编码
ALTER DATABASE database_name CHARACTER SET character_name collate collate_name;