MySQL 创建数据库的简单示例(utf-8格式)

前端之家收集整理的这篇文章主要介绍了MySQL 创建数据库的简单示例(utf-8格式)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编两巴掌来看看吧!

Linux代码

GBK: create database test2 DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
UTF8: CREATE DATABASE `test2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

eg:

Linux代码

[root@linuxtest test]# MysqL -u root -p
Enter password:
Welcome to the MysqL monitor.  Commands end with ; or \g.
Your MysqL connection id is 5
Server version: 5.1.30-community MysqL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
MysqL> CREATE DATABASE `test` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK,1 row affected (0.06 sec)
MysqL> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| cacti              |
| MysqL              |
| test               |
+--------------------+
5 rows in set (0.07 sec)

这个test库就是utf-8格式的

原文链接:https://www.f2er.com/mysql/530232.html

猜你在找的MySQL相关文章