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