RE: [PHP-DB] Loading database information from a text file

From: Date: Sun, 08 Jun 2003 05:07:55 +0000
Subject: RE: [PHP-DB] Loading database information from a text file
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-28423@lists.php.net to get a copy of this message
> I have a text file with all my database information > from creating databases to setting up tables. I have > looked throught the mysql docs on how to load these on > from a text file via the mysql prompt. But all I can > find is: > > load data infile "filename.txt" into table whatever > > But this is not what I am looking for. :( As the > tables are already defined in the text file and the > appropiate database name to enter them into. > > Is there a way to load these into the database > directly instead of doing each table seperately from > the mysql prompt? (not web admin) Is this a mysqldump file? The file has all of the SQL statements that you need to run? If so, just send it to mysql... Mysql -uuser -ppassword database_name < filename.txt You can call that through exec() if you want. The file must be proper SQL, though. ---John W. Holmes... Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.db (#28423) next »