mysqldump --opt test -u root --password=qwe123 -R > d:\ab.sql
因为存储过程不是存储在你的数据库中而是在mysql数据库文件夹中。 --routines, -R
Dump stored routines (procedures and functions) from the dumped databases. Use of this option requires the SELECT privilege for the mysql.proc table. The output generated by using --routines contains CREATE PROCEDURE and CREATE FUNCTION statements to re-create the routines. However, these statements do not include attributes such as the routine creation and modification timestamps. This means that when the routines are reloaded, they will be created with the timestamps equal to the reload time.
If you require routines to be re-created with their original timestamp attributes, do not use --routines. Instead, dump and reload the contents of the mysql.proc table directly, using a MySQL account that has appropriate privileges for the mysql database.
This option was added in MySQL 5.1.2. Before that, stored routines are not dumped. Routine DEFINER values are not dumped until MySQL 5.1.8. This means that before 5.1.8, when routines are reloaded, they will be created with the definer set to the reloading user. If you require routines to be re-created with their original definer, dump and load the contents of the mysql.proc table directly as described earlier.
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 DROP PROCEDURE IF EXISTS `pdm_update_player_online_by_time` */;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50020 DEFINER=`dbo_endwar`@`%`*/ /*!50003 PROCEDURE `pdm_update_player_online_by_time`()
MODIFIES SQL DATA
COMMENT 'Procedure for updating dm_player_online_by_time table.'
BEGIN
DECLARE v_timeslot int unsigned default TIME_TO_SEC(CURTIME());
DECLARE v_date date default CURDATE();
IF (v_timeslot % 3600) <= 180 THEN
SET v_timeslot = ROUND(v_timeslot/3600)*3600;
UPDATE dm_player_online_by_time,
(SELECT c_faction.c_faction_id,
COUNT(*) as players_by_faction
FROM presence, c_faction left join c_player on c_faction.c_faction_id = c_player.c_faction_id
WHERE presence.userid = c_player.c_player_id
AND presence.isonline is true
GROUP BY c_faction.c_faction_id
) as online_players_by_faction
SET dm_online_players = players_by_faction,
dm_is_updated = true
WHERE dm_timeslot = v_timeslot
AND dm_faction_id = c_faction_id
AND dm_is_updated is false;
Error Code : 1064
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 'ELSEIF p_total_cr_point>=2500 AND p_total_cr_point<2700 THEN
return 11' at line 1
(0 ms taken)
Error Code : 1064
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 'END IF' at line 1
(0 ms taken)
Error Code : 1064
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 'return 12' at line 1
(0 ms taken)
Error Code : 1064
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 'END */' at line 1
(0 ms taken)
这个就是错误信息 语法错误 我就奇怪了?
/*!50003 这个 但是并没有执行 比如下面的
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 DROP PROCEDURE IF EXISTS `resolve_winner_for_primary_frontline` */;
--
-- WARNING: old server version. The following dump may be incomplete.
--
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
DELIMITER ;;
In this case, MySQL Server parses and executes the code within the comment as it would any other SQL statement, but other SQL servers will ignore the extensions. For example, MySQL Server recognizes the STRAIGHT_JOIN keyword in the following statement, but other servers will not:
SELECT /*! STRAIGHT_JOIN */ col1 FROM table1,table2 WHERE ...
If you add a version number after the “!” character, the syntax within the comment is executed only if the MySQL version is greater than or equal to the specified version number. The TEMPORARY keyword in the following comment is executed only by servers from MySQL 3.23.02 or higher:
CREATE /*!32302 TEMPORARY */ TABLE t (a INT);
The comment syntax just described applies to how the mysqld server parses SQL statements. The mysql client program also performs some parsing of statements before sending them to the server. (It does this to determine statement boundaries within a multiple-statement input line.)