(ERROR 1366 (HY000): Incorrect string value:'\xD5\xD4' for column 'name' at row

login to mysql -->

Enter the corresponding database --->

Type: show variables like '%char%';

 

Got it:

+--------------------------+--------------------------------------+

| Variable_name            | Value                                |

+--------------------------+--------------------------------------+

| character_set_client     | utf8                                 |

| character_set_connection | utf8                                 |

| character_set_database   | latin1                               |

| character_set_filesystem | binary                               |

| character_set_results    | utf8                                 |

| character_set_server     | latin1                               |

| character_set_system     | utf8                                 |

| character_sets_dir       | F:\SoftWare\mysql5.5\share\charsets\ |

+--------------------------+--------------------------------------+

 

If you need to change the encoding database in the above situation, there are two ways: the first way to do it once (if the table already exists, it needs to be recreated), the second way is only valid for the current connection, disconnect the connection, and restore the original state

Method 1: alter database database name charset utf8;

方法2: set character_set_database = utf8;

 

In use: show variables like '%char%';

 

+--------------------------+--------------------------------------+

| 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     | latin1                               |

| character_set_system     | utf8                                 |

| character_sets_dir       | F:\SoftWare\mysql5.5\share\charsets\ |

 

+--------------------------+--------------------------------------+

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326484259&siteId=291194637