MySQL exports a table starting with H

Source: Internet
Author: User

Scenario: I have hundreds of tables that start with H, and I need to back up the tables that start with H.

Mysqldump does not support * or% of this wildcard character, so it is not possible to backup the table starting with XX, this is a small trick, using a text editor to implement.

[Email protected]~]# mysql-uroot-p-s-e "SELECT table_name from Information_schema.tableswhere table_schema= ' Helei ' an D table_name like ' h% ' ";

Enterpassword:

table_name

H1

H2

H3

H4

H5

Mysqldump syntax is the library name [space] table name [space] table name [space] table name, for example: Mysqldump-uroot-p helei H1 H2 H3 >helei.sql


The key here is how to convert multiple columns to a column separated by a space so that you can match mysqldump 's syntax.

650) this.width=650; "title=" 1.JPG "style=" Float:none; "alt=" wkiol1do6fqcjujbaabemvktdsm209.jpg-wh_50 "src=" http:/ S1.51cto.com/wyfs02/m01/83/06/wkiol1do6fqcjujbaabemvktdsm209.jpg-wh_500x0-wm_3-wmp_4-s_1174462565.jpg "/>

First, hold down the ALT key to achieve multi-column editing, and then enter any character, I use the ', '



650) this.width=650; "title=" 2.JPG "style=" Float:none; "alt=" wkiom1do6fvscbrkaabodh3gcpu885.jpg-wh_50 "src=" http:/ S5.51cto.com/wyfs02/m01/83/07/wkiom1do6fvscbrkaabodh3gcpu885.jpg-wh_500x0-wm_3-wmp_4-s_3781743918.jpg "/>

Use a text editor that is often used here notpad++ , select Edit - Row Operations - Merging rows can



650) this.width=650; "title=" 3.JPG "style=" Float:none; "alt=" wkiol1do6fuxynkwaadmwon5aco922.jpg-wh_50 "src=" http:/ S3.51cto.com/wyfs02/m01/83/06/wkiol1do6fuxynkwaadmwon5aco922.jpg-wh_500x0-wm_3-wmp_4-s_1853016081.jpg "/>

Ctrl+f Bulk Replace function, replace ', ' with a space



650) this.width=650; "title=" 4.JPG "style=" Float:none; "alt=" wkiol1do6fucvoa8aabaewroz3k097.jpg-wh_50 "src=" http:/ S3.51cto.com/wyfs02/m02/83/06/wkiol1do6fucvoa8aabaewroz3k097.jpg-wh_500x0-wm_3-wmp_4-s_2700869061.jpg "/>


H1 H2 H3 H4 H5


complete!




PS: can also be implemented using Mydumper, Mydumper 1 time times faster than mysqldump, and its parameters--regex support regular expression

This article is from the "Age volt" blog, please make sure to keep this source http://suifu.blog.51cto.com/9167728/1791395

MySQL exports a table starting with H

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.