mysql中如何在創建數據庫的時候指定數據庫的字符集


1.使用create database語句創建數據庫

mysql> create database if not exists test03 default character set = 'utf8';
Query OK, 1 row affected (0.00 sec)

備注:通過default character set = 語句來指定DB的字符集.

2.查看創建的DB的字符集

mysql> select schema_name,default_character_set_name from information_schema.schemata where schema_name = 'test03';
+-------------+----------------------------+
| schema_name | default_character_set_name |
+-------------+----------------------------+
| test03      | utf8                       |
+-------------+----------------------------+
1 row in set (0.00 sec)

備注:通過系統表schemata查看可以知道,DB的字符集是utf8的.同時,數據庫的字符集是utf8,那么在這個數據庫下創建的表的字符集也都是utf8的.也就是數據庫的字符集對於后續創建的表是有影響的.

 

資料來源:http://www.cnblogs.com/chuanzhang053/p/9121506.html 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM