备份数据库时getaccountname不存在报错

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

我正在尝试使用以下命令从 .sql 转储文件恢复我的 MYSQL 5.7 数据库:

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

但是,我收到以下错误:

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

.sql 文件的第 5940 行包含以下内容:

/*!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')

如上面的评论所述,mysqldump --routines 需要在转储输出中包含存储过程、函数和事件。默认情况下不启用此选项,因此您必须记住在转储数据库时使用它。