How to run a sql script sql script on mysql5

Bradley Giesbrecht pixilla at macports.org
Wed Apr 4 12:29:49 PDT 2012


On Apr 4, 2012, at 12:14 PM, Michael Parchet wrote:

> Hello,
> 
> I have install the mysql5 port. I do a secure installation whith only the root user and a password.
> 
> So noe I wold like to run a sql script to create a database.
> 
> I have tried the following command but this last has no effect
> 
> sudo  mysql5 -u root -p password script.sql
> 
> Can you help me please ?

You should probably take this to a mysql support forum.

I do this:
$ mysql5 -uroot -p
mysql> create database mydb;
mysql> use mydb;
mysql> system ls;
mysql> source script.sql;
mysql> show tables;
mysql> exit;

Your script.sql file may well create a database or has a "use dbname" statement at the top.
http://dev.mysql.com/doc/refman/5.0/en/batch-commands.html



Regards,
Bradley Giesbrecht (pixilla)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2763 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20120404/4da6c90f/attachment.bin>


More information about the macports-users mailing list