Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7580493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:55:54+00:00 2026-05-30T17:55:54+00:00

Sometimes I need to copy MySQL database (db1) to another database (db2). I found

  • 0

Sometimes I need to copy MySQL database (db1) to another database (db2). I found this command to be concise and effective:

mysqldump --opt db1 | mysql db2

It was working fine, but now it breaks with following error:

ERROR 1064 (42000) at line 1586: 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 ‘mysqldump: Couldn’t execute ‘SHOW TRIGGERS
LIKE ‘some_table_name”: MySQL server ‘ at line 1

First thing that comes to mind is that database is too big (uncompressed SQL dump is >1G, 1090526011 bytes at the moment, to be precise) for piping it like this. When I do mysqldump > file and then mysql < file it works fine, no errors. Table mentioned in error message (some_table_name) is not big or special.

Second idea comes from the impression that error message might be truncated, and that it says

“…MySQL server has gone away”

Quick research on that says it’s possible that maximum number of open files (for MySQL and/or system) is reached. So I’ve tried adding --skip-lock-table to mysqldump and raising open-files-limit, but no luck, same error.

Obvious solution is to do dump and then import (as it works fine), but piping seems better and more clean to me (let me know if I’m wrong), plus I’m curious to find out what causes this problem. Did I hit some limit that affects command piping?

I’ve been doing this on hosting server, running MySQL 5.1.60 on Linux and on my dev machine – MySQL 5.1.58 on Linux. Latter gives a bit different error:

mysqldump: Error 2013: Lost connection to MySQL server during query
when dumping table other_table_name at row: 7197


UPDATE: Problem is solved by doing separate dump and import, without pipe. Even though I feel it’s not really answer to my question, ssmusoke’s suggestions were most to the point resulting in accepted answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:55:55+00:00Added an answer on May 30, 2026 at 5:55 pm

    The problem may be that the load on the servers gets too high doing both dumping and loading at the same time. This also means that you lose some optimizations like extended inserts, ability to disable foreign keys which can be achieved when you dump a file then import it.

    I would recommend that you use mysqldump to generate the backup then load it using mysql. That way the load on your server is reduced, and like you said it always works. You can even automate it into a bash script to do both so that you do not need to execute the mysqldump and loading commands.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I sometimes need to run gacutil.exe or installutil.exe, etc. from the command line. Is
In my app I sometimes need to rebuild and repopulate database file. SQLite databse
Sometimes you need to upgrade the database with many rows that you have in
Have a class Hero. Sometimes I need a deep copy (when all members are
Sometimes I need to perform following command cp -rv demo demo_bkp However I want
I sometimes need to use Visual Studio when I have limited screen real estate
I sometimes need to look for information for a special portion of code. When
I sometimes need to debug JS in other browsers, and it would be really
If i iterate over a STL container i sometimes need to know if the
In the form designer, I sometimes need to see the type of a property,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.