Home > Back-end >  Do line endings matter when moving mysql database between windows and linux?
Do line endings matter when moving mysql database between windows and linux?

Time:11-27

I am exporting a MySQL database on a windows machine (running XAMPP) to then import into a Linux server (using cmdline or phpMyAdmin IMPORT "filename.sql") The dbdump file has mixed LF/CRLF line endings, and I know Linux uses LF for line endings. Will this cause a problem? Thanks

CodePudding user response:

MySQL's SQL tokenizer skips all whitespace characters, according to ctype.h.

CodePudding user response:

I anticipate that the mysql program on each platform would expect "its" line-ending style. I honestly don't know if, on each platform, it is "smart enough" to know what to do with each kind of file. (Come to think of it, maybe it does ...) Well, there's one sure way to find out ...

You say that the file has mixed(?!) line-endings? That's very atypical ...

However, there are ready-made [Unix/Linux] utilities, dos2unix and unix2dos, which can handle this problem – and I'm quite sure that Windows has them too. Simply run your dump-file through the appropriate one before using it.

  • Related