Re: How to run a sql script sql script on mysql5

2012-04-05 Thread Bradley Giesbrecht
On Apr 5, 2012, at 9:21 AM, Michael Parson wrote:

> On Wed, 4 Apr 2012, Michael Parchet wrote:
> 
>> 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 ?
> 
> Close, but try this:
> sudo mysql5 -u root -p password < script.sql

If "script.sql" does not "create/use" a database you may need to add the 
database to the command.

$ mysql5 -uroot -p -e "create database if not exists dbname;"
$ mysql5 -uroot -p dbname < script.sql


Regards,
Bradley Giesbrecht (pixilla)



smime.p7s
Description: S/MIME cryptographic signature
___
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users


Re: How to run a sql script sql script on mysql5

2012-04-05 Thread Michael Parson

On Wed, 4 Apr 2012, 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 ?


Close, but try this:

sudo mysql5 -u root -p password < script.sql

--
Michael Parson
Unix Thug
Austin, TX
KF5LGQ
___
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users


Re: How to run a sql script sql script on mysql5

2012-04-04 Thread Michael Parchet

Le 04.04.12 21:37, Lawrence Velázquez a écrit :

On Apr 4, 2012, at 3:14 p.m., Michael Parchet wrote:

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.


Are you making a local database? Have you installed mysql5-server?

Yes ouf course.


vq



___
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users


Re: How to run a sql script sql script on mysql5

2012-04-04 Thread Lawrence Velázquez
On Apr 4, 2012, at 3:14 p.m., Michael Parchet wrote:

> 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.


Are you making a local database? Have you installed mysql5-server?

vq

___
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users


Re: How to run a sql script sql script on mysql5

2012-04-04 Thread Bradley Giesbrecht

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)



smime.p7s
Description: S/MIME cryptographic signature
___
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users


How to run a sql script sql script on mysql5

2012-04-04 Thread Michael Parchet

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 ?

Best regards

mparchet


___
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users