After the reinstallation of mysql the scrambled code can be set to utf8 to solve the problem
- 2020-05-27 07:20:50
- OfStack
View current connection system parameters: SHOW VARIABLES LIKE '%char%';
mysql > show variables like 'char%';
+--------------------------+----------------
| Variable_name | Value
+--------------------------+----------------
| character_set_client | gbk
| character_set_connection | gbk
| character_set_database | latin1
| character_set_filesystem | binary
| character_set_results | gbk
| character_set_server | latin1
| character_set_system | utf8
| character_sets_dir | C:/
+--------------------------+----------------
8 rows in set (0.00 sec)
mysql >
The database and server character sets can only be set to utf8 in the configuration file, otherwise they do not work
On the command line: stop command: net stop mysql
Start command: net start mysql
mysql core configuration file my.ini
[mysql] main configuration command line client parameter default-character-set =utf8 -- affects client, connection, result
[mysqld] configure the server parameter character-set-server =utf8 -- affects database server
When mysql adds function function, set global log_bin_trust_function_creators=1; Specify parameters or the creation will not succeed
mysql > show variables like 'char%';
+--------------------------+----------------
| Variable_name | Value
+--------------------------+----------------
| character_set_client | gbk
| character_set_connection | gbk
| character_set_database | latin1
| character_set_filesystem | binary
| character_set_results | gbk
| character_set_server | latin1
| character_set_system | utf8
| character_sets_dir | C:/
+--------------------------+----------------
8 rows in set (0.00 sec)
mysql >
The database and server character sets can only be set to utf8 in the configuration file, otherwise they do not work
On the command line: stop command: net stop mysql
Start command: net start mysql
mysql core configuration file my.ini
[mysql] main configuration command line client parameter default-character-set =utf8 -- affects client, connection, result
[mysqld] configure the server parameter character-set-server =utf8 -- affects database server
When mysql adds function function, set global log_bin_trust_function_creators=1; Specify parameters or the creation will not succeed