When restoring data mysql Chinese garbled

mysql Chinese garbled data recovery, solution.

With the source command mysql database how to import Chinese encoding settings

1. export data to specify the encoding
when exporting mysql sql executable file, specify what encoding formats:

mysqldump -uroot -p --default-character-set=utf8 mo(dbname) > E://xxxx.sql

2. import data specified encoding

mysql -u root -p --default-character-set=utf8 
use dbname 
source /root/newsdata.sql

 

Guess you like

Origin www.cnblogs.com/liuxm2017/p/11126978.html