Error importing MySQL data across platforms (MAMP to WIMP)
Asked Answered
C

4

0

I've dumped a MySQL database I have on my local MAMP server into a .sql file. Usually, it's easy enough for me to import that file to my production Linux servers without a hitch. However, my current client runs MySQL on WIMP, and when import the MAMP-generated .sql dump into my WIMP mysql environment (Using pphpMyAdmin) I get a "File could not be read" error?

Any ideas of what I'm bumping up against, or what to check? Thanks-

EDIT:

My initial explanation was unclear- I'm trying to export out of MAMP, and import into WIMP

Coition answered 16/6, 2011 at 13:22 Comment(1)
Post command which you are using.Lorilee
T
1

The most likely cause for this problem is the different end of line conventions on DOS and UNIX platforms. Windows uses the DOS convention of '\r\n' for newlines, while Mac OSX and Linux use the UNIX convention of '\n' for newlines. To fix the problem, run the unix2dos utility on the mysql dump file on your Mac and then copy the file to your Windows box.

Tortile answered 16/6, 2011 at 13:34 Comment(4)
@Zhehao- My question was unclear- I'm trying to go the other way, from mac to windows- can you revise your answer?Coition
@Zhehao- How do you get/access unix2dos on Mac- I just spent half hour downloading a version from here: us.osxgnu.org/pub/osxgnu/File_utils/unix2dos-1.2X.pkg.sit and it says it requires 'Rosetta software' to run, not to mention stuffit, etc.... There's got to be an easier way!?Coition
Yikes! Sorry about that. I assumed that it was installed by default. I am a linux user, not a Mac user, so my apologies. The dos2unix and unix2dos programs can be obtained from thefreecountry.com/tofrodos. Apparently they have Windows binaries too, so you can do the conversion on your Windows box if you prefer.Tortile
@Zhehao- Although I presume your way probably works, I ended up just doing a copy-paste from one SQL pane to another, which worked for me (See my answer). I'll give you the credit though, as it got me there- thanksCoition
T
0

Are you sure you sure the mySQL linux server has permission to read the file?

Tutt answered 16/6, 2011 at 13:26 Comment(0)
P
0
  1. Your .sql file should be converted to unix file endings. You can use dos2unix (or frodos) on Mac & Linux.
  2. What is the size of your db.sql file? I think phpMyAdmin has file size limits.
  3. You could try using mysql at the command line to see if it gives you additional info.

mysql -u user -p -D db < file

Popper answered 16/6, 2011 at 13:37 Comment(1)
@ttymatty- My question was unclear- I'm trying to go the other way, from mac to windows- can you revise your answer?Coition
C
0

@Zhehao pointed out the issue, which entails converting the newlines of the .sql file.

However, I just wanted to share another way around this that worked for me was to simply dump to the SQL pane instead of a file, and then copy-paste it into the target phpMyAdmin SQL pane.

Coition answered 16/6, 2011 at 17:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.