mysql command import file garbled solution

Method 1:
Solve the problem of garbled characters by adding the parameter –default-character-set = utf8
mysql -u root -p password < path_to_import_file –default-character-set = utf8

Method 2:
1. Execute mysql -uroot -p to enter the password to log in;
2 , use database_name;
3, set names utf8; (or other required codes)
4, source example.sql (sql file storage path)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326381034&siteId=291194637
Recommended