mysqldump - How to Create Master script file to run mysql scripts -
i want create db structure application in mysql, have 100 scripts create tables , sp, functions in different schemas.
please suggest how can run script 1 after other , how can stop if previous script failed. using mysql 5.6 version.
i currrently runnning them using text file.
mysql> source /mypath/createdb.sql
which contains
tee /logout/session.txt
source /mypath/00-createschema.sql
source /mypath/01-createtable1.sql
source /mypath/01-createtable2.sql
source /mypath/01-createtable3.sql
but running simultaniously , have foreign key in below tables due giving error.
the scripts not running simultaneously. mysql client not execute in multi-threaded manner.
but it's possible sourcing scripts in order causes foreign keys reference tables haven't defined yet, , problem.
you have 2 possible fixes problem:
create tables in order avoid problem.
create tables without foreign keys, run script contains
alter table add foreign key
... statements.
Comments
Post a Comment