MySQL basic configuration mysql default character encoding settings (My.ini set character encoding) MySQL default encoding is Latin1, does not support Chinese, then how to modify the default MySQL code, the following to set UTF-8 as an example to illustrate.
MySQL default encoding is Latin1, does not support Chinese, then how to modify the default MySQL code, the following UTF-8 as an example to illustrate
It is important to note that there are many places to modify, and there are a lot of ways to modify them. Here is one of the simplest and most thorough methods:
first, the Windows system under 1, abort MySQL service 2, found in the MySQL installation directory My.ini, if not the My-medium.ini copy to a My.ini can 3, open My.ini after the [client] and [mysqld] below are added Default-character-set=utf8, save and close (mysqld Increase if error, you can try Character-set-server=utf8) 4, Start the MySQL service
ii. Linux System below 1, abort MySQL service (bin/mysqladmin-u root shutdown) 2, in/etc/ Find MY.CNF, if not the MySQL installation directory under the Support-files directory under the MY-MEDIUM.CNF copy to/etc/and renamed to MY.CNF can be 3, open my.cnf after the [client] and [mysqld] Add Default-character-set=utf8 below, save and close 4, start MySQL service (Bin/mysqld_safe &)
Very simple, such a modification once and for all, in the future MySQL all the relevant default encoding is UTF-8, create a new table without having to set the
It is important to note that the existing data in the current database still retains the current encoding, and therefore need to self-transcoding, the method on the Internet a lot, no longer repeat
Note: If you are in a higher version of MySQL, add the
Modify the MySQL default encoding to UTF-8? Simply add at the end of the [mysqld] group name in My.ini:
Character-set-server=utf8
Can. What is the reason why the Mysqld:unknown variable ' Default-character-set=utf8 ' is wrong? Because the parameter: Default-character-set=utf8 has been removed from the newer version of MySQL. Therefore, it is recommended that the high version of MySQL use "character-set-server" instead of "Default-character-set".
View character encoding : When set up, how do you see if the character encoding we set is OK? You can enter at the command prompt: SHOW VARIABLES like ' char% '
Original link: http://blog.csdn.net/zhuoxiong/article/details/7453773
MySQL basic configuration MySQL default character encoding setting (My.ini set character encoding) (GO)