Ubuntu modify my. the cnf file causes mysql to fail to start. Recently, mysql was configured on the Virtual Machine. After installation, the character set is displayed as show variables like 'character % '; + bytes + | Variable_name | Value | www.2cto.com + bytes + | character_set_client | utf8 | character_set_connection | utf8 | character_set_database | latin1 | bytes | binary | utf8 | | character_set_server | latin1 | character_set_system | utf8 | character_sets_dir |/usr/share/mysql/charsets/| + ---------------------- + bytes +
First, you need to change all to utf8, and modify the mysql STARTUP configuration file according to the online prompt my. the basic steps for cnf online are: Find [client] and add: default-character-set = utf8 // The default character set is utf8 www.2cto.com. Find [mysqld] and add: // The default character set is utf8 default-character-set = utf8 // set utf8 encoding when connecting to the mysql database to run the mysql database as utf8
Init_connect = 'set NAMES utf8'. However, after the modification, I started the mysql service and reported an error. I failed to start the mysql service and tried a variety of solutions online. I did not solve the problem. Finally, I found a solution to solve the problem, as shown below: others are the same as above. Only default-character-set = utf8 added under [mysqld] is changed to character-set-server = utf8 to restart mysql, start successfully and check the code as: www.2cto.com
+ Bytes + | Variable_name | Value | + bytes + | character_set_client | utf8 | character_set_connection | utf8 | character_set_database | utf8 | bytes | binary | utf8 | | character_set_server | utf8 | character_set_system | utf8 | character_sets_dir |/usr/share/mysql/charsets/| + ---------------------- + bytes +