PHP uses a database when doing projects. When you create a database, you will inevitably enter Chinese characters. But in the SQL command console, the SQL statements are inserted in Chinese, and the final query comes out with the results. instead of. Looked very headache. I was just starting out. Set the default encoding in the phpMyAdmin, first change the database encoding method, and then change the table encoding method, in the field encoding. It's very annoying. The watermelon knives were taken out at the foot. Forgive my not calm, then how to create a database in phpmyadmin The default encoding is Utf-8 ?
Here I introduce this method, once and for all.
phpMyAdmin the default encoding for creating a database is: latin1_swedish_ci
The way to modify the default encoding is
1. Login phpMyAdmin
2. In the navigation section point: Variable
3.ctrl+f Find: Latin1_swedish_ci
4. Change all the latin1_swedish_ci with the desired encoding, I set to: Utf8_general_ci
Come on, you!
You can then enter in the SQL command console: Show variables like '%char% ';
Found that there are latin1, that is, psoriasis is really annoying ah. Continue to change
command line input set Character_set_database=utf8;
Enter set Character_set_server=utf8 again; (These two are not the same Ah, note)
It's done. Hemp no longer have to worry about my SQL results are garbled. Do not worry about the child shoes can continue to enter:show variables like '%char% ', this sentence to see whether the success. This is mine.
Finally, thank you for watching. Have time to exchange PHP together.
phpMyAdmin Creating a database setting default encoding