MySQL Forums
Forum List  »  Perl

Re: to do mysql source command from perl
Posted by: Felix Geerinckx
Date: November 15, 2006 07:38AM

Rytis Diciunas Wrote:


> $sth = $dbh->prepare ("source /home/user/ids.sql;");
> $sth->execute;
>
> where ids.sql includes other source and load commands....
>
> mysql gives me error:
> DBD::mysql::st execute failed: You have an error in your SQL syntax;

'source' is not an SQL command, but an internal command of the mysql command line client.

You could use Perl's system() function:
system('/path/to/mysql -uuser -ppassword database </home/user/ids.sql');

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
Re: to do mysql source command from perl
November 15, 2006 07:38AM


Sorry, you can't reply to this topic. It has been closed.

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.