RE: Loading database information from a text file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux