Method: 1. Add "default-character-set=gbk" under "no-auto-rehash" in the "my.ini" file; 2. Add "character-" after "port= 3306" set-server=gbk", save the changes and restart.
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
Description of phenomenon:
After XAMMP is installed, a MySQL database is built-in. After creating my own database, when I add some Chinese information to the table through hibernate, all the garbled characters turn into "??".
Problem solution:
1. Find D:\\xampp\\mysql\\bin\\my.ini in the installation directory, (my own path , the path here is the path where you installed xampp) open it with notepad;
2. Add default-character-set=gbk under no-auto-rehash under [mysql];
3. Add character-set-server=gbk under port= 3306 under [mysqld], save this line of code, and restart xampp.
Extended knowledge:
XAMPP (Apache MySQL PHP PERL) is a powerful website building integration software package. The original name of this package was LAMPP, but to avoid misunderstanding, the latest versions were renamed XAMPP. It can be installed and used under various operating systems such as Windows, Linux, Solaris, Mac OS X, etc., and supports multiple languages: English, Simplified Chinese, Traditional Chinese, Korean, Russian, Japanese, etc.
Many people realize through their own experience that installing an Apache server is not an easy task. If you want to add MySQL, PHP, and Perl, it's even harder. XAMPP is an easy-to-install Apache distribution that includes MySQL, PHP, and Perl. XAMPP is really easy to install and use: just download, unzip, and launch.
Recommended learning: mysql video tutorial
The above is the detailed content of What to do if mysql is garbled in xampp. For more information, please follow other related articles on the PHP Chinese website!