سؤال

I've exported a MySQL v4.0.25 script to a sql file and since I can't find an installer for 4.0 anymore the only option left is to use 4.1.. Now, I'm getting the common 1064 error since v4.0 doesn't have utf-8 (only latin-1) and v4.1 gives me a syntax error.

I'd be okay with editing the files manually but, one of the scripts is a file 12GB big and the other one is 5GB so I can't even find an editor able to open a file that large and a problem at hands with this migration (the files are that big because they are a copy of 2 production DBs with over 10years use).

How can I fix or bypass this problem? Any chance I can tell the import script to ignore the lines with errors (and I don't even know how many are there..)?

هل كانت مفيدة؟

المحلول

If it's still possible, dump the data structures in sql and the data tables in csv format using mysqldump --tab=path. This way, any modifications you will need to do will be on the much smaller sql file, keeping the large data files untouched. They you could later import the whole thing using mysqlimport command.

Alternatively, you could always use the mysql --force option for importing your sql file.

More information:

For manually editing the files:

If you are using Linux as your operating system, then there is a big variety of commands in your hand: more, less, sed, etc. sed is good for substitutions, similar to your question. A nice tutorial can be found at http://www.grymoire.com/Unix/Sed.html

In Windows, I sometimes use PowerShell. I had similar post on StackOverflow about "mysqldump without database name" where there is an example of how to replace a string in a dump file.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top