December 4th, 2002, 01:28 PM
FTP file transfer problem with "\n" fordatabase replication
I'm working on some scripts to replicate a mysql data base from one local server to a remote server. I'm using FTP to transfert a text file with the last queries, so i can execute those queries in the remote server.
Some times it work, sometimes it does'nt. I think that the problem is that I use the \n character to break the lines( separate the queries?) in the local text files, but in the remote server instead of breaking the lines there is a little square that appears in the file created by the ftp transfert.
Can any one help me?
December 4th, 2002, 02:49 PM
It's most likely due to the fact that UNIX/Linux uses "\n" to terminate a line, whilst Windows uses "\r\n" to terminate a line. If it just sees "\n" it can't deal with it, so it sometimes prints the box you're seeing. The solution is to copy the files directly from one server to the other (using scp), or possibly transferring the file using a Windows box but enabling the "binary" option in file transfer mode (not sure if this will stop Windows arbitrating over the file contents, but it might).
Hope this helps.
December 4th, 2002, 03:49 PM
This seems to fix the problem of the line ending,thanks!
By the way I'm doing the testing beetween two windows servers, but the implementation will be done between a windows and a linux server.
I'm testing this replication system, if it doesn't work, I'm going to read more about the mysql replications options...
Last edited by mreyes; December 4th, 2002 at 03:53 PM.