MySQL uses Informatin_schema tables to create the shell commands

Source: Internet
Author: User

Select CONCAT ("Mysqldump-uroot-p", Table_schema, "", TABLE_NAME, ">>", Table_schema, ". Bak.sql")

From INFORMATION_SCHEMA WHERE table_name like ' country% ';

You can also save the generated shell command in a file (but it must be a local folder, or the host folder where the client resides, or the mapped server folder, and the file does not exist)

Select CONCAT ("Mysqldump-uroot-p", Table_schema, "", TABLE_NAME, ">>", Table_schema, ". Bak.sql")

From INFORMATION_SCHEMA WHERE table_name like ' country% '

Into OUTFILE ' c:/sample.sh ';

The Concat () method is a string join method, and if it contains null, the result is null, specifically see

Http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_concat

MySQL uses Informatin_schema tables to create the shell commands

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.