MySQL: Import multiple sql files into specific database

All about shell scripts.
Post Reply
User avatar
vst
Admin
Posts: 81
Joined: Thu Jan 15, 2009 2:36 pm

MySQL: Import multiple sql files into specific database

Post by vst » Sat Jan 23, 2016 1:52 pm

Hi there,

I run into the problem while exporting data into a project folder using MySQL Workbench. Next I tried to import those files into my local development machine but got an "no database selected" error. This .sql files didn't have the "use database;" and MySQL WB unfortunately don't import into the selected database. So I had to import the files using the commandline tools.

Code: Select all

$ cd [project folder]
$ find . -name '*.sql' | awk '{ print "source",$0 }' | mysql -u [username] -p [database] --batch
You are welcome.


All the best,
so long and thank you for the fish
staubmann.eu

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest