functionmysqlproceduresroutines

MySQLdump hangs with routines


I am trying to use a bat file to do a complete copy of a database to a different database. There are procedures and functions which need to be transferred over which is my biggest problem.

When I use

mysqldump -u user -p password db1 -v -R | mysql -u user -p password db2

It will copy all of the tables no problem, but hangs when it comes to the procedures and functions with this

..
-- Sending SELECT query...
-- Retrieving rows...

I have quite a few functions and procedures that needs to be copied over. Any help would be appreciated.


Solution

  • ROOT CAUSE

    SUGGESTION

    Load the data first. Write Stored Procedures to a text file. The, load the code.

    mysqldump -u user -p password db1 -v --skip-routines | mysql -u user -p password db2
    mysqldump -u user -p password db1 -t -d --routines > stored_procs_from_db1.sql
    mysql -u user -p password db2 < stored_procs_from_db1.sql
    

    GIVE IT A TRY !!!