List:General Discussion« Previous MessageNext Message »
From:walt Date:July 31 2002 8:13pm
Subject:Re: Running an SQL file from the command line
View as plain text  
Scott Pippin wrote:

> I need to run a file called sms.sql from the command line.  Is this
> possible and what is the syntax?
> Thanks in advance.
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <mysql-thread116046@stripped>
> To unsubscribe, e-mail <mysql-unsubscribe-kernel=nea-fast.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

/usr/bin/mysql -u user_name database < sms.sql

I added this to my .bashrc  and saved my password in ~/.my.cnf
alias sql='/usr/bin/mysql -u xxx xxx '

then added
sq ()
{
  sql < $1
}

which allows me to use
sq sms.sql

walt


Thread
Running an SQL file from the command lineScott Pippin31 Jul
  • Re: Running an SQL file from the command linewalt1 Aug
  • Re: Running an SQL file from the command lineFrancisco Reinaldo1 Aug