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