MySQL Bulk build library Guide data script

Source: Internet
Author: User

Database Name list into a file

# Cat 00db.txtinformation_schemadb_app_cmsdb_eopdb_leader_cmsdb_leader_comment

Mysqldump out of the SQL data into a file inside

# cat 00dbsql.txt-rw-r--r--1 root root 970701283 may 03:39 information_schema-2017-05-16-033001.sql-rw-r--r--1 roo T root 32156 May 03:39 db_app_cms-2017-05-16-033001.sql-rw-r--r--1 root root 169522095206 * * 05:50 db_eop-2 017-05-16-033001.sql-rw-r--r--1 root root 99699 may 05:50 db_leader_cms-2017-05-16-033001.sql-rw-r--r--1 root Root 256290013 May 05:51 Db_leader_comment-2017-05-16-033001.sql


Bulk build library and import data scripts

# cat 00createdb.sh#!/bin/bashfor i in  ' Cat 00db.txt '          do                 for j in  ' cat /data/backup/00dbsql.txt | awk -f  '   '   ' {print $9} '   '                  do                    if [[  $j  == * "$i" * ]];                  then    mysql - uroot -proot -s  /data/mysql_data/sock/my3306.sock  -e  "create  database  $i; "                          mysql -uroot -proot -s /data/mysql_data/sock/my3306.sock  $i   <  $j                         echo  $i           fi                 Done                done

Execute script

#nohup 00createdb.sh &


MySQL Bulk build library Guide data script

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.