从phpMyAdmin转储中删除DELIMITER

时间:2014-02-11 08:26:40

标签: mysql sql phpmyadmin delimiter

我正在转储我的MySql数据库。我正在使用phpMyAdmin并使用“导出”选项卡进行转储。 问题是,对于TRIGGERS phpMyAdmin设置DELIMITER //,然后将其设置为默认DELIMITER ;,但它会在旧版本的phpMyAdmin上生成error in SQL syntax其他情况。有人可以帮我删除phpMyAdmin中的此选项吗?也许我理解错了什么?

Sql代码

--
-- Triggers `checklist_question`
--
DROP TRIGGER IF EXISTS `checklist_question_insert`;
DELIMITER //
CREATE TRIGGER `checklist_question_insert` BEFORE INSERT ON `checklist_question`
 FOR EACH ROW SET NEW.www_or_app = IF(@APPLICATION IS NULL, 'www', 'app')
//
DELIMITER ;
DROP TRIGGER IF EXISTS `checklist_question_update`;
DELIMITER //
CREATE TRIGGER `checklist_question_update` BEFORE UPDATE ON `checklist_question`
 FOR EACH ROW SET NEW.www_or_app = IF(@APPLICATION IS NULL, 'www', 'app')
//
DELIMITER ;

例外代码

Codeception PHP Testing Framework v1.8.2
Powered by PHPUnit 3.7.28 by Sebastian Bergmann.


←[37;41m
       ←[0m
←[37;41m  [Codeception\Exception\Module]
       ←[0m
←[37;41m  (Exception in Db) SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual
 that  ←[0m
←[37;41m   corresponds to your MySQL server version for the right syntax to use near 'DELIMITER //
       ←[0m
←[37;41m  CREATE TRIGGER `checklist_question_insert` BEFORE INSERT ON `checkl' at line 1
       ←[0m
←[37;41m  SQL query being executed:
       ←[0m
←[37;41m  DELIMITER //
       ←[0m
←[37;41m  CREATE TRIGGER `checklist_question_insert` BEFORE INSERT ON `checklist_question`
       ←[0m
←[37;41m   FOR EACH ROW SET NEW.www_or_app = IF(@APPLICATION IS NULL, 'www', 'app')
       ←[0m
←[37;41m  //
       ←[0m
←[37;41m  DROP TRIGGER IF EXISTS `checklist_question_update`
       ←[0m
←[37;41m
       ←[0m

1 个答案:

答案 0 :(得分:1)

DELIMITER不是MySQL命令。这是MySQL客户端需要支持的命令。 尝试将所有//替换为;并删除DELIMITER声明。