Knowledge Base
MilesWeb / Dedicated Server FAQ

Importing / Exporting MySQL Database With The Exact Character Set On The Dedicated Server

Approx. read time : 2 min

In order to avoid issues with the data that contains non-english characters, exact character set has to be used for importing the MySQL database.

For instance, if Unicode (UTFB) is the character set of your data, the following command can be used for importing the character set:

mysqldump -uUSERNAME -pPASSWORD –default-character-set=utf8 USER_DATABASE > backup.sql

The attributes – USERNAME, PASSWORD and USER_DATABASE can be updated with the relevant values pertaining to your database and then a file “backup.sql” will be created that will be encoded in UTF-8.

If any empty MySQL database is used for importing the backup, the exact character set for the data can be inserted manually. You will have to use the following command for doing this:

mysql -uUSERNAME -pPASSWORD –default-character-set=utf8 USER_DATABASE < backup.sql

Replace –default-character-set=utf8 with the respective character set used for creating the backup.sql file for making sure that the data is inserted correctly.

Admin
With over 10+ years of experience in the web hosting industry, I have achieved extensive exposure to result-oriented methodologies. And expertise in different domains like Datacentre Services, Cloud computing technology, Web hosting industry and many more.