Monday, March 22, 2010


this how the usual CLI for mysqldump
mysqldump -u username -p dbname > backupname.sql

restore back from mysql

mysql -u username -p dbname '<' yousqldumpfile.sql

Recently, I was facing problem to restore a UTF8-Enabled database which stores a lot of Arabic text in the db itself.

I have to re-dump back the db by appending the --default-character-set=charset_name option in the dump command :

mysqldump -uroot -p --default-character-set=utf8 --databases yourdbname > yourdumpfile.sql

To restore, again you have to append the same option :

mysql -uroot -p --default-character-set=utf8 '<' youdumpsql.sql ** i need to add '<' because i will become hidden in this blog,if you want tu use the sqldump please to remove ' at '<' on restore CLI.