in reply to Import dump file into mysql DB using DBI
... near '; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 S' at line 7 at resultsDBsource.pl line 34, <FH> chunk 1.
(UPDATE: I should have checked the mysql manual first; C-style comments are allowed, and comments starting with /*! are "special": not ignored, but used to flag statements that use mysql-specific extensions to SQL, and the digits following /*! indicate what (earliest) version of mysql is needed for the extended statement to work. What do you know about the version of the server you are using?)
Rather than reading the whole file as a into a single scalar, you should use the idea mentioned above, setting $/ to the string that marks the end of an sql statement, and read the file one statement at a time, and -- this is important -- on each statement, check for "/*commented strings*/" and remove them before preparing the statement.
If you are trying to load a database on a server where you do not have login shell access, you might want to have mysql running on your own machine, and try loading the dump file locally via a shell command line:
will load the file contents into the "test" database. Revise the dump file until that operation produces the desired result, then load the dump file on the remote server.mysql test < dump.file
(If you are able to connect to the target database from anywhere via a login-shell "mysql" command, why not just load the dump file that way?)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Import dump file into mysql DB using DBI
by siva kumar (Pilgrim) on Oct 11, 2007 at 12:46 UTC | |
by naikonta (Curate) on Oct 12, 2007 at 01:05 UTC | |
by moritz (Cardinal) on Oct 11, 2007 at 13:26 UTC |