Link to home
Start Free TrialLog in
Avatar of SaltyDawg
SaltyDawgFlag for United States of America

asked on

Exectue mySQL file by command line located on web server

I need to be able to execute an sql file (file.sql) located in a web site directory:

/home/salty/file.sql

I have gotten this far


Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5050 to server version: 5.0.24

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

not sure the command to use here


Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

you have 2 options:

mysql [your connection options, if any] < home/salty/file.sql

with the < character which will instruct the mysql to get that file contents as input.

or:

for the mysql prompt, use:
source file_name




reference:
http://dev.mysql.com/doc/refman/5.0/en/mysql.html
Avatar of SaltyDawg

ASKER

Ok right now I'm trying to connect to the database on the web server using plink via the Windows Command Prompt. I know how to connect through plink but once I get there I still need to execute the *.sql file.

I when using "source" do I need to use the server document root path "/home/user/www/"? If so then I must be doing something else wrong. Each way I try I get nothing.

Thanks for the help
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks alot. It was an honor being helped by the great angelIII, lol

I'll probably be back a few more times with more questions in this same project, so keep an eye on my threads. I'll open a new question for each little issue I have, I believe in maximizing my points giving no matter how small my issue. Its the least I can do for the great help EE has given me over the past years.