Home  >  Article  >  Database  >  Mysql恢复数据报ERROR 1308 : LEAVE with no matching label_MySQL

Mysql恢复数据报ERROR 1308 : LEAVE with no matching label_MySQL

WBOY
WBOYOriginal
2016-05-30 17:10:171691browse

赶紧看备份日志,日志如下:

----------------------------------

===BEG:20151108 01:00:01=====

===FTP:20151108 01:00:05=====

===CLS:20151108 01:00:07=====

===OPT:20151108 01:00:08=====

===END:20151108 01:00:08=====

----------------------------------

 

日志并没有什么异常,既然说有问题,那就恢复一下吧

为了加快恢复的速度,先设置参数:

mysql>

SET  sql_log_bin = 0

SET  autocommit=0;

SET  net_buffer_length=10485760;

SET  innodb_flush_log_at_trx_commit=0;

SET  sync_binlog=0

 

mysql> source 备份文件

 

发现果然报错了:

 

ERROR 1308 (42000) at line 2428811: LEAVE with no matching label: loo

查看备份文件的242881行,发现这一行是创建存储过程的语句,而且这个存储过程没有备份完整,这就是恢复出错的原因

 

为什么备份的时候存储过程没有备份完整呢?这个问题再研究,先解决问题吧,把备份数据和备份存储过程分开

 

/usr/local/mysql/bin/mysqldump -uroot -pxxxx   --default-character-set=utf8 -n -d -t -R  --databases  xxxx  >R.sql

 

参数说明如下:

-n:   --no-create-db

-d:   --no-data

-t:   --no-create-info

-R:   --routines      Dump stored routines (functions and procedures)

 

恢复备份的存储过程和函数

 

mysql

 

补充:为了查找为什么mysqldump备份的时候存储过程会没有备份完整,我查看了其他几天的备份文件,存储过程都是备份完整的,只有一种解释,我同事给我的那份备份文件被损坏了。。。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn