Page 1 of 1

Piping SQL commands from DCL

Posted: Tue Oct 04, 2005 3:10 pm
by issinoho
You can connect to MySQL using
$ mysql -umyacc -pmypwd database
or
$ mysql --user=myacc --password==mypwd database

If you need to execute a file within sql you can use the "source" command:
mysql> source file.sql

Or to pipe directly,
$ pipe mysql -uusername -ppassword database < file.sql

Posted: Thu Nov 10, 2005 2:00 am
by chaos88
Very kewl indeed.
It works a little different than usual pipe in VMS but it saved my a... and cured my headache.

I was actually trying to use mysqldump to backup the ... phpbb2 database. Yes I just got it running. I wish I can post a link here but is an intranet only site. :(

Anyways thanks for the article and if can add to it, it works for backup as well as I mentioned.

$ pipe mysqldump --opt database_name -u root -p > phpdb2_bak.sql

creates the phpbb2_bak.sql file which you can restore from using your command

Many thanks again,