dpchen2004 2019-08-07 21:56
浏览 332

如何正确迁移存储过程?

I'm tasked with transferring a site from an old client server, to a new server. I've done a sqldump from the old server and have imported into the new server, and it's working except for some sql calls done in php with mysqli.

I'm not that familiar with stored procedures, but what I have noticed is the ones that fail are queries that look like this:

$db->query("call functionName($id)");

They keep returning false on the new server, which makes me think the stored procedure isn't transferring over.

What I've looked into this has led me to believe this is a stored procedure. But when, I look to the methods of exporting it nothing works.

Old site is running on Ubuntu 18.04 / MariaDB 10.3.17 New site is Ubuntu 18.04 / MariaDB 10.4.7

Am I missing something? Any help will be appreciated, feel this is a bit out of what I'm used too.

Edit: Want to show what the sqldump looks like with the parameters --routines --no-create-info --no-data --no-create-db --skip-opt

As you can see it's empty, so is it something else other than a stored procedure/function?

/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Dumping routines for database 'database_name'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2019-08-07 17:33:52
  • 写回答

2条回答 默认 最新

  • dsdioa9545 2019-08-07 22:14
    关注

    You have to transfer also the stored procedures and the functions make following msqldump and import it into the new database.

    mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt mydb > mydb.sql
    
    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler