Search code examples
mysqlsqlmysql-error-1064

Getting error of getaccountname doesn't exist while backing up database


I am trying to restore my MYSQL 5.7 database from .sql dump file with the following command:

mysql -h hostname -u username -p databasename < backup.sql

But, I am getting the following error:

ROR 1305 (42000) at line 5940: FUNCTION dbtable.getaccountname does not exist

The line 5940 of .sql file contains the following:

/*!50001 VIEW vloantransaction AS select loantransaction.transactionid AS transactionid,loantransaction.bookingdatenp AS bookingdatenp,loantransaction.accountnumber AS accountnumber, getaccountname(loantransaction.accountnumber,'a') AS accname,getaccountname (loantransaction.accountnumber,'h')


Solution

  • As mentioned in the comment above, mysqldump --routines is required to include stored procedures, functions, and events in the dump output. This option is not enabled by default, so you have to remember to use it when you dump your database.