MySQL Forums
Forum List  »  MySQL Shell

Re: How can i execute an MySQL command through a shell script?
Posted by: Frederic Descamps
Date: February 26, 2021 06:56PM

Hi Karan,

if you run the following command in ssh, it means that 'filename.sql' is also on the server.

mysql -h "server-name" -u root "password" "database-name" < "filename.sql"

You are doing Perl alreay, certainly called by bash, so I don't really understand why you would load the sql file in shell.

However as you want it:

mysqlsh --sql root@server-name/database-name < filename.sql

Ineractively it would be something like

SQL > source filename.sql

Regards,

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How can i execute an MySQL command through a shell script?
53
February 26, 2021 06:56PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.