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