今天在導入mysqldump導出的數據的時候出現了一個奇怪的錯誤?mysql
ERROR 1064 (42000) at line 13327: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1sql
打開文件的13327行,發現這個是一個觸發器的SQL語句帶有 /*! */ 不仔細看覺得建立triggers失敗app
可是手工執行的時候確實這樣子的:ide
mysql> /*!50003 CREATE*/ /*!50017 DEFINER=`appuser`@`%`*/ /*!50003 TRIGGER `b_admin_user_update` AFTER UPDATE ON `b_admin_user` FOR EACH ROW測試
-> INSERT INTO delta_b_admin_user(`user_id`,`username`, `password`, `salt`, `real_name`, `cell_phone`, `qq`, `phone`, `email`, `wangwang`, `created_time`, `last_login_time`, `last_login_ip`, `user_group_id`, `flag`, `parent_id`, `qr_code`)code
-> valuesserver
-> (NEW.user_id,NEW.username, NEW.password, NEW.salt, NEW.real_name, NEW.cell_phone, NEW.qq, NEW.phone, NEW.email, NEW.wangwang, NEW.created_time, NEW.last_login_time, NEW.last_login_ip, NEW.user_group_id, NEW.flag, NEW.parent_id, NEW.qr_code); */;;ip
Query OK, 0 rows affected (0.01 sec)it
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1io
這是執行成功了呢? 但仍是報了個錯誤:(
通過查找,發現mysql在導入的時候有個參數是忽略錯誤繼續執行後面的SQL知道整個文件執行完成
--force 這個參數,加上參數再導入一次
/usr/local/mysql-5.6/bin/mysql -uroot -p'pass' --force < /usr/local/mysql-5.6/all.sql
Warning: Using a password on the command line interface can be insecure.
ERROR 1064 (42000) at line 13327: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1
ERROR 1064 (42000) at line 13345: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1
ERROR 1064 (42000) at line 15612: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1
ERROR 1064 (42000) at line 15630: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1
ERROR 1064 (42000) at line 21753: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1
ERROR 1064 (42000) at line 21771: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1
ERROR 1064 (42000) at line 28734: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1
恩,確實沒有退出。
以後又作了一個測試
在導出數據的時候不導出觸發器,那麼須要加上參數 --skip-triggers
再導入的時候就沒有報錯了
那麼是否是mysql-5.6版本的關係麼?
有待研究