run a bash file to connect to remote server an execute an sql file

I need to be able to run a bash file to connect to remote server an execute an sql file
LVL 1
SaltyDawgAsked:
Who is Participating?
 
fosiul01Connect With a Mentor Commented:
I guess its like this
#!/bin/bash

scp database.sql username@hostname:/databasedump/database.sql
ssh username@hostname:
mysql --user=mylogin --password=mypass MyDatabse < database.sql
0
 
SaltyDawgAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.