Sometimes when we are developing, we need to use the mysql database. How to prevent Chinese garbled characters from appearing. The editor below will share how to set the encoding method of the mysql database
Mysql client to view and modify the encoding method
1. The first step is to open the mysql software, enter the password, and press the Enter key, as shown in the following figure:
2. In the second step, enter "use day14_customer;" on the command line, press Enter, enter the database, pay attention to the last semicolon, day14_customer is the name of the database, As shown in the figure below:
##3. In the third step, enter "show create database day14_customer;" to view the database Encoding method
##4. Step 4: Modify the database encoding information and enter
“alter database day14_customer default character set gbk;”
mysql graphical interface to modify the viewing encoding method
1. The first step is to open the graphical interface of mysql. Here I installed SQLyog. As shown in the figure below:
2. In the second step, right-click the database and select "Change Database"
3. In the third step, we can modify the database encoding method, as shown in the figure below:
Test whether the database encoding contains Chinese garbled characters
1. The first step is to open the table in our database and click "Table Data" on the right
2. In the second step, we can see the specific data in the database. We can see that there are no Chinese garbled characters, as shown in the figure below:
##
The above is the detailed content of How to set and view MySQL database encoding. For more information, please follow other related articles on the PHP Chinese website!