MySql Chinese recognition problems
I have always wanted to avoid the problem of MySql Chinese recognition, but I did use it when I was working on the project today, which made me very angry, after trying every means, I finally found a solution that is accurate to me for one night.
Because I directly installed wampserver, I don't know the version or why. I couldn't find the corresponding character encoding configuration in my. ini file.
Ah, think about it. Forget it. If this doesn't work, run the command directly. So I entered the following [1] [2] command. After I restarted MySql, it was found that there was no change at all, and it was still not recognized to add data after the command was entered. This is a problem, so I thought about it and looked for it .....
Finally, I found a relatively general method, that is, when I create a database, I should specify the character encoding, so I had to run the [4] command.
After testing, the database is perfectly compatible with Chinese characters. It means that Mysql does not recognize UTF-8 at the client end. This is what I want to do. Isn't one encoding complete?
So, we should continue to use our big country code...
SET character_set_server = gbk; // SET the server's character encoding [1]
SET character_set_database = gbk; // SET the character encoding of the database. [2]
Show variables like 'character % '; // query all character codes. [3]
Create database name character set gbk; [4]
SET character_set_server = gbk; // SET the character encoding of the server.
SET character_set_database = gbk; // sets the character encoding of the database.
Show variables like 'character % '; // query all character encodings
Create database name character set gbk;