MySQL database import help

Associate
Joined
24 Jun 2006
Posts
1,462
Hi folks,

I'm having a problem importing a database. Please don't comment on the design, I didn't do it and I can't change it, I'm just trying to import it.

Normally I would use:

Code:
mysql -u xxxx -p -D databaseName < db.sql

The problem I'm having is that some wonderful person has decided to use a text field as the key in a table. This means I have values like '4000' and '4000 ' (note the end space). It appears they were also too stupid to trim the data before the insert.

Anyways MySQL seems to trim these fields when it does an insert so it's causing duplicate fields.

Has anyone run into this before? I've tried on 5.2 on Win 7 and 5.0 on Debian 5. I'm about to try installing MySQL 4 as it's a MySQL 4 database.

Any help greatly appreciated :)
Paul.
 
Is the field value a CHAR/VARCHAR?

Both do not allow trailing spaces even if the previous numpty managed to insert them.

Also, if the field length sufficient?
 
Nope it's a TINYTEXT.

It appears to be an incompatibility between a MySQL 4 db extract and trying to import into MySQL 5.

I've imported into MySQL 4 without any trouble.
 
Back
Top Bottom