Mysql setting method to insert Chinese without garbled characters: first specify [set names latin1;] in the SQL file; then import through the MySQL command, the code is [[root@localhost ~]# mysql -uroot -p123456 test< ;tes].
mysql settings method to insert Chinese without garbled characters:
Method one:
Log in to MySQL, first do set names latin1, and then update the statement or execute the SQL statement
mysql> set names latin1; mysql> source test.sql;
Method 2:
Specify set names in the SQL file latin1;Then log in to MySQL and execute the corresponding file
[root@localhost ~]# cat test.sql set names latin1; insert *****************; mysql> source test.sql;
Method three:
Specify set names latin1;and then import through the MySQL command
[root@localhost ~]# mysql -uroot -p123456 testMethod 4:
Achieved by specifying the character set parameter of the MySQL command--default-character-set=latin1
[root@localhost ~]# cat test.sql insert *****************; [root@localhost ~]# mysql -uroot -p123456 --default-character-set=latin1 testMore Related free learning recommendations:mysql tutorial(video)
The above is the detailed content of How to set up mysql to insert Chinese without garbled characters. For more information, please follow other related articles on the PHP Chinese website!