Error importing MySQL data across platforms (MAMP

2019-03-05 12:16发布

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

4条回答
老娘就宠你
2楼-- · 2019-03-05 12:18

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

查看更多
可以哭但决不认输i
3楼-- · 2019-03-05 12:36

@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.

查看更多
Viruses.
4楼-- · 2019-03-05 12:40

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.

查看更多
Deceive 欺骗
5楼-- · 2019-03-05 12:43
  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

查看更多
登录 后发表回答