To Export/Import MySQL database with correct character set on Linux export your database with the correct character set is important to avoid any kind of problems with data that has non English characters within the table.

For example, if the character set of the database is Unicode (UTF8) you can use the following command to export it using this character set:

Command would be as below:

# mysqldump -u User -p Password –default-character-set=utf8 Database > backup.sql

Replace User, Password and Database with values for your database and you will have a file named “backup.sql” encoded in UTF-8.

When you import a database backup into an empty MySQL database tables then you can set the exact character set for the data. For that use the following syntax for the command as follows:

# mysql -uUser -pPassword –default-character-set=utf8 Database < backup.sql

Replace –default-character-set=utf8 with the charset used for the creation of the backup.sql file.