csdnceshi62 2008-09-19 19:07 采纳率: 100%
浏览 174
已采纳

不使用锁表运行 MySQLDump

I want to copy a live production database into my local development database. Is there a way to do this without locking the production database?

I'm currently using:

mysqldump -u root --password=xxx -h xxx my_db1 | mysql -u root --password=xxx -h localhost my_db1

But it's locking each table as it runs.

转载于:https://stackoverflow.com/questions/104612/run-mysqldump-without-locking-tables

  • 写回答

13条回答 默认 最新

  • 程序go 2008-09-19 19:09
    关注

    Does the --lock-tables=false option work?

    According to the man page, if you are dumping InnoDB tables you can use the --single-transaction option:

    --lock-tables, -l
    
    Lock all tables before dumping them. The tables are locked with READ
    LOCAL to allow concurrent inserts in the case of MyISAM tables. For
    transactional tables such as InnoDB and BDB, --single-transaction is
    a much better option, because it does not need to lock the tables at
    all.
    

    For innodb DB:

    mysqldump --single-transaction=TRUE -u username -p DB
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(12条)

报告相同问题?

悬赏问题

  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝