1

Im trying to do an initial transfer of my data to a replica server by running this command:

sudo mysqldump -f -u root -pPassword --opt mydb | mysql --host=replica01 -C mydb -u restore -pPassword

It copies most of the data, but stops on one of the functions i've created with this error:

ERROR 1305 (42000) at line 3750: FUNCTION mydb.myFunction does not exist mysqldump: Got errno 32 on write

I have both procedures and functions in my database. Some procedures use functions in them. Is that what is causing this? In that case, what can i do to ignore these errors?

asked Jan 13, 2023 at 13:29
1
  • 1
    Any functions that are used need to be defined before they are used. Try editing the dump and shift them. Commented Jan 13, 2023 at 13:42

1 Answer 1

1

You should try doing mysqldump without the stored procedures

In your case, it would be

sudo mysqldump -f -u root -pPassword --skip-routines -opt mydb | mysql --host=replica01 -C mydb -u restore -pPassword

You should also dump the stored procedures into a text file

See my old post Dump only the Stored Procedures in MySQL

In your case it would be

mysqldump -f -u root -pPassword --routines --skip-triggers --no-data --no-create-info -opt mydb > mydb_sp.sql

Have a look at the file

less mydb_sp.sql

then import the stored procedures like this

mysql --host=replica01 -C mydb -u restore -pPassword < mydb_sp.sql
answered Jan 13, 2023 at 15:24
1
  • Turned out procedures were skipped, but there was a view that utilized one of them. Marked as answer as it put me in the right track. Thank you! Commented Jan 16, 2023 at 8:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.