Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If a database contains contains table of different charset, what should I do in order to have them appear in a single file? or is it possible?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I think you may be better off using the --tab option to mysqldump and dumping each table to a separate .sql and .txt pair of files, but if you want to use a single dump file I'd:

  • Use mysqldump as usual specifying the default charset of the majority of the tables.
  • Then edit the dump file to change the charset in the creation statement for the tables that are different.

If the dump's huge use an editor that can handle such files or make the changes using sed.

A third alternative would be to use just two dump files by selecting tables using the --tables parameter to mysqldump. First select all the regular tables and then select the group that's different, specifying the right charset as default each time.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.