There are different ways to modify the MySQL character set in different environments. The following describes how to modify the MySQL character set in the Liunx environment. If you are interested in this, take a look. Modify MySQL character set in Liunx: 1. find the location of MySQL cnf file find-iname *. cnf-printusrsharemysqlmy-innodb-h
There are different ways to modify the MySQL character set in different environments. The following describes how to modify the MySQL character set in the Liunx environment. If you are interested in this, take a look. Modify MySQL character set in Liunx: 1. find the location of MySQL cnf file find/-iname '*. cnf'-print/usr/share/mysql/my-innodb-h
There are different ways to modify the MySQL character set in different environments. The following describes how to modify the MySQL character set in the Liunx environment. If you are interested in this, take a look.
Modify the MySQL character set in Liunx:
1. Find the cnf File Location of MySQL
Find/-iname '*. cnf'-print
/Usr/share/mysql/my-innodb-heavy-4G.cnf.
/Usr/share/mysql/my-large.cnf.
/Usr/share/mysql/my-small.cnf.
/Usr/share/mysql/my-medium.cnf.
/Usr/share/mysql/my-huge.cnf.
/Usr/share/texmf/web2c/texmf. cnf
/Usr/share/texmf/web2c/mktex. cnf
/Usr/share/texmf/web2c/fmtutil. cnf
/Usr/share/texmf/tex/xmltex/xmltexfmtutil. cnf
/Usr/share/texmf/tex/jadetex/jadefmtutil. cnf
/Usr/share/doc/MySQL-server-community-5.1.22/my-innodb-heavy-4G.cnf
/Usr/share/doc/MySQL-server-community-5.1.22/my-large.cnf
/Usr/share/doc/MySQL-server-community-5.1.22/my-small.cnf
/Usr/share/doc/MySQL-server-community-5.1.22/my-medium.cnf
/Usr/share/doc/MySQL-server-community-5.1.22/my-huge.cnf
2. Copy small. cnf, my-medium.cnf, my-huge.cnf, one of the my-innodb-heavy-4G.cnf to/etc, named my. cnf
Cp/usr/share/mysql/my-medium.cnf/etc/my. cnf
3. modify my. cnf
Vi/etc/my. cnf
Add under [client]
Default-character-set = utf8
Add under [mysqld]
Default-character-set = utf8
4. Restart MySQL
[Root @ bogon ~] #/Etc/rc. d/init. d/mysql restart
Shutting down MySQL [OK]
Starting MySQL. [OK]
[Root @ bogon ~] # Mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 1
Server version: 5.1.22-rc-community-log MySQL Community Edition (GPL)
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
5. View MySQL Character Set settings
Mysql> show variables like 'collation _ % ';
+ ---------------------- + ----------------- +
| Variable_name | Value |
+ ---------------------- + ----------------- +
| Collation_connection | utf8_general_ci |
| Collation_database | utf8_general_ci |
| Collation_server | utf8_general_ci |
+ ---------------------- + ----------------- +
3 rows in set (0.02 sec)
Mysql> show variables like 'character _ set _ % ';
+ -------------------------- + ---------------------------- +
| Variable_name | Value |
+ -------------------------- + ---------------------------- +
| Character_set_client | utf8 |
| Character_set_connection | utf8 |
| Character_set_database | utf8 |
| Character_set_filesystem | binary |
| Character_set_results | utf8 |
| Character_set_server | utf8 |
| Character_set_system | utf8 |
| Character_sets_dir |/usr/share/mysql/charsets/|
+ -------------------------- + ---------------------------- +
8 rows in set (0.02 sec)
Mysql>