› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
ywt474000158
V2EX  ›  MySQL

如何用正则导出多个表

  •  
  •   ywt474000158 · Feb 28, 2017 · 4425 views
    This topic created in 3537 days ago, the information mentioned may be changed or developed.
    比如我想导出(dbname 的 test_1, test_2, test_3, test_4 ...)

    mysqldump -u root -p123456 dbname test_* > mysql.sql

    有没有这样的用法啊
    5 replies  •  2017-03-01 00:06:16 +08:00
    zbinlin
    zbinlin
    Feb 28, 2017
    1
    加 --databases 参数?
    mysqldump -u root -p123456 --databases dbname test_* > mysql.sql
    ywt474000158
    ywt474000158
    OP
    Feb 28, 2017
    2
    @zbinlin 好像是不能用通配符,写一个文件再用文件去导出表应该是靠谱的做法。
    py123456
    py123456
    Feb 28, 2017❤️2
    3
    mysql -uroot -p123456 dbname -e "show tables like 'test_%'"|egrep "test_[0-9]+"|xargs mysqldump -uroot -p123456 dbname > dbname.sql
    ywt474000158
    ywt474000158
    OP
    Mar 1, 2017
    4
    @py123456 这个可以,多谢啦。
    zbinlin
    zbinlin
    Mar 1, 2017
    5
    @ywt474000158 看错了,看成导出多个 db 了 /汗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1361 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 20:19 · PVG 04:19 · LAX 12:19 · JFK 15:19
    ♥ Do have faith in what you're doing.