mysqldump --default-character-set

今天用mysqldump 倒数据,忽然发现忘记使用了 --default-character-set 了,那就借机看下,如果不加导出编码,那么 mysqldump 是按照啥编码来定的呢?

我查看了导出的sql 文件的内码是:UTF8的

然后我运行了一下命令:


mysql> show variables like 'charac%';
+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | ascii |
| character_set_connection | ascii |
| character_set_database | gbk |
| character_set_filesystem | binary |
| character_set_results | ascii |
| character_set_server | gbk |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/share/mysql/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.00 sec)

mysql> show create database test;
+----------+--------------------------------------------------------------+
| Database | Create Database |
+----------+--------------------------------------------------------------+
| test | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET gbk */ |
+----------+--------------------------------------------------------------+
1 row in set (0.00 sec)



mysql> show create table test.rep1_test;
+-----------+--------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-----------+--------------------------------------------------------------------------------------------------------------------------+
| rep1_test | CREATE TABLE `rep1_test` (
`v` varchar(4) DEFAULT NULL,
`c` char(4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=gbk |
+-----------+--------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

看了以上所有的编码显示。唯一只有可能的是:

character_set_system | utf8

系统编码~~~。 这个不肯定。改天那里看到了肯定了。在补上吧

你可能感兴趣的:(sql,C++,c,mysql,SQL Server)