Re: MySQL in Batch Mode.

From: Date: Wed, 06 Dec 2000 09:50:28 +0000
Subject: Re: MySQL in Batch Mode.
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-4324@lists.php.net to get a copy of this message
If you're on the local host and are logged in as the default user, then you don't kneed the <user> <password> part of this command. By the way, if you have a pile of data to put into a table, it's a lot easier to use the LOAD INTO command, and pipe a text file (any extension, and when you call the command, specify how the data is seperated - eg comma delimited, tab delimited...) to this. In this way, you can load as many rows as you want in a single command. First create a table, at the command prompt type mysql<create_mytable.txt where the file create_mytable.txt contains the following USE MyDB; CREATE TABLE MyTable ( column1 varchar(50), column2 varchar(100) ); Then say you have a data file called MyTable_data.txt which contains two columns of comma delimited data, type (from within MySQL) use MyDB; LOAD DATA INFILE 'MyTable_data.txt' INTO TABLE MyTable FIELDS TERMINATED BY ','; Tom Woods Ron Contr SA-ALC/FMIS wrote: > >From a DOS prompt try; > > mysql -u<user> -p<password> < [filename with any ext] > > first command in [filename] should be use <db name>; > > Ron Woods/GAI > Sr. Software Engineer > 1777 N.E. Loop 410 > Suite 600 > San Antonio, TX 78217 > Tel: 210-820-2615 > Fax: 210-832-0487 > http://www.gai-inc.com > > -----Original Message----- > From: PHP [mailto:mwazir@vsnl.com] > Sent: Tuesday, December 05, 2000 11:19 AM > To: php-windows@lists.php.net > Subject: [PHP-WIN] MySQL in Batch Mode. > > Hi, > I want to populate a small database from a script file in MySQL. Basically > has CREATE TABLE and INSERT statements. > Can anyone give me an example of running this script in batch mode. Is MySQL > specific about the file extention. > Any syntax example would do. I can pick on and experiment from there. > Thanks a lot > > - Mujahid > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > For additional commands, e-mail: php-windows-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.windows (#4324) next »