This last part of the error message:
... near ';
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 S' at line 7 at resultsDBsource.pl line 34, <FH> chunk 1.
looks sort of like the dump file has been edited in some way to place C-style commenting marks around some lines. I shouldn't be surprised of mysql rejects this (the normal way to comment out a line of SQL is to put two hyphens at the beginning.)
(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:
mysql test < dump.file
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.
(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?) |