SyntaxFix
Write A Post
Hire A Developer
Questions
Tags
Basically, I need to setup a database from a bash script. I have a script db.sql that does all this. Now how do I run this script from bash?
Database system is mysql
This question is related to mysql database linux bash
mysql
database
linux
bash
You simply need to start mysql and feed it with the content of db.sql:
db.sql
mysql -u user -p < db.sql
If you want to run a script to a database:
mysql -u user -p data_base_name_here < db.sql
Source: Stackoverflow.com