The default encoding of the mysql database is not UTF-8. After mysql is installed, start the service and log on. Run the show variables command to view the default encoding of the mysql database. The character set of the visible database and server uses the latin1 encoding method and does not support Chinese characters, that is, garbled characters appear when you store Chinese characters. The following is the process of modifying the command line to UTF-8 encoding to support Chinese characters. Www.2cto.com (1) Disable mysql service [plain] service mysql stop (2) Modify/etc/mysql/my. cnf (default installation path) [plain] vim/etc/mysql/my. cnf www.2cto.com open my. after cnf, add the following two rows under [mysqld] in the file: [plain] character_set_server = utf8 init_connect = 'set NAMES utf8' (as shown in): Save and exit.
(3) Restart mysql service www.2cto.com [plain] service mysql start. After modifying the default encoding, log on to mysql and use show variable like '% character %' again to obtain the following output: note: