The database is garbled because of the MySQL encoding cause.
Workaround:
Modifying the MySQL database character encoding for Utf-8,utf-8 contains the characters that are required for all countries worldwide and is an international code.
Specific operation:
1 , go to MySQL console
>mysql-uroot-p # Enter password into >status; # View the current MySQL run status as shown in:
2 , modifying the MySQL configuration file
[[Email protected] ~] # vi/etc/my.cnf # Add the following code to the [client] segment default-character-set=UTF8# adds the following code to the [MySQL] segment character-set-server=UTF8 # Add the following code to the [mysqld] segment Character-set-server=utf8
3 , restart the MySQL service
[[Email protected] ~] # Service mysqld Restart # check back into the MySQL console as shown in:>status;
>show variables like ' character_set_% '; # view MySQL Character set
MySQL database character set encoding modification complete!
Parameter description:
Character_set_client: The character set of the client request data.
Character_set_connection: A character set that receives data from the client and then transmits it.
Character_set_database: The character set of the default database, regardless of how the default database is changed, is this character set, and if there is no default database, this parameter does not need to be set character_set_server the specified character set.
Character_set_filesystem: The operating system on the file name into this character set, that is, the character_set_client conversion character_set_filesystem, the default binary can be.
Character_set_results: The character set of the result set.
Character_set_server: The default character set for the database server.
Character_set_system: This value is always utf8 and does not need to be set to store the system metadata for the character set.
Linux modified MySQL database character encoding for UTF-8 solve Chinese garbled