Re: MySQL in Batch Mode.
| From: | David Tod Sigafoos | Date: | Tue, 05 Dec 2000 17:30:58 +0000 |
| Subject: | Re: MySQL in Batch Mode. | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-4310@lists.php.net to get a copy of this message | ||
Hello PHP,
Tuesday, December 05, 2000, 9:19:19 AM, you wrote:
P> Hi,
P> I want to populate a small database from a script file in MySQL. Basically
P> has CREATE TABLE and INSERT statements.
P> Can anyone give me an example of running this script in batch mode. Is MySQL
P> specific about the file extention.
P> Any syntax example would do. I can pick on and experiment from there.
P> Thanks a lot
Create a 'text' file with the following and save in the mysql\bin
directory
#
# Table structure for table 'counter'
#
CREATE TABLE counter (
type varchar(80) DEFAULT '' NOT NULL,
var varchar(80) DEFAULT '' NOT NULL,
count int(10) unsigned DEFAULT '0' NOT NULL
);
#
# Dumping data for table 'counter'
#
INSERT INTO counter VALUES ('total','hits',1);
INSERT INTO counter VALUES ('browser','WebTV',0);
INSERT INTO counter VALUES ('browser','Lynx',0);
INSERT INTO counter VALUES ('browser','MSIE',0);
INSERT INTO counter VALUES ('browser','Opera',0);
INSERT INTO counter VALUES ('browser','Konqueror',0);
then at the command line in your mysql\bin directory simply say
mysql databasename < textfile
The 'textfile' could be counter.sql or counter.txt or fubar.me
--
DSig
David Tod Sigafoos
mailto:dsig@teleport.com
Using 'The Bat' 1.48 Beta/8
`````
( O O )
_______oOOo__( )__oOOo_______