简体   繁体   English

恢复数据库时表错误

[英]Table Errors while restoring database

I've previously asked a question on dumping a database by splitting it into tables separately. 我之前已经通过分别将它拆分成表来询问有关转储数据库的问题 Well, I manage to do it with mysqldump command but however, when I try to restore the database locally to extract some data's.. it stops with an error at certain point. 好吧,我设法使用mysqldump命令,但是,当我尝试在本地恢复数据库以提取一些数据时...它会在某个时刻停止并显示错误。 A table which contains data's more than 2GB. 一个包含超过2GB数据的表。 Even I tried restoring each table to see whether it gives me a success. 即使我尝试恢复每张桌子,看看它是否给了我一个成功。 But it was still the same... its the same table which gives an error. 但它仍然是相同的...它是同一个表,它给出了一个错误。

Can anyone tell me whether there's a way to repair a downloaded dump or check downloaded table by checking each?? 谁能告诉我是否有办法修复下载的转储或通过检查每个检查下载的表?

thanks in advance. 提前致谢。

EDIT: This is the error I got " ERROR 2006 (HY000) at line 5855099: MySQL server has gone away " 编辑:这是我得到的错误“ ERROR 2006 (HY000) at line 5855099: MySQL server has gone away

EDIT 2: When I tried this on my VPS via SSH.. it gave me this error " ERROR 1153 (08S01) at line 4215: Got a packet bigger than 'max_allowed_packet' bytes " 编辑2:当我通过SSH在我的VPS上尝试这个...它给了我这个错误“ ERROR 1153 (08S01) at line 4215: Got a packet bigger than 'max_allowed_packet' bytes

Finally after a certain search and further checking the errors I found out that max_allowed_packet variable was causing this issue as usual. 最后经过一定的搜索并进一步检查错误,我发现max_allowed_packet变量像往常一样导致了这个问题。 Though I'm not an expert in such field, I'm happy that I figured out. 虽然我不是这方面的专家,但我很高兴我发现了。 I would like to share the link which helped me to fix this issue and also how I achieved it. 我想分享帮助我解决这个问题的链接,以及我是如何实现它的。

This is what I did.. 这就是我做的..

  1. I first logged into mysql server using mysql -u user -p & by entering the password. 我首先使用mysql -u user -p &登录到mysql服务器,输入密码。
  2. Then I executed following commands; 然后我执行了以下命令;

set global net_buffer_length=1000000; set global net_buffer_length = 1000000;
set global max_allowed_packet=1000000000; set global max_allowed_pa​​cket = 1000000000;

  1. Finally I left the terminal as it is & opened a new one, then I executed below command which did the magic without any interruptions.. 最后我离开了终端并打开了一个新终端,然后我执行了下面的命令,它完成了魔术而没有任何中断。

mysql --max_allowed_packet=100M -u root -p database < dump.sql

I hope this may help any other facing such issues. 我希望这可以帮助任何其他人面对这些问题。

Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM