Re: newbe: how to import a whole db from an .sql file

From: Date: Thu, 21 Feb 2002 12:51:35 +0000
Subject: Re: newbe: how to import a whole db from an .sql file
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17126@lists.php.net to get a copy of this message
Hi Steven, The problem is that when doing mysql_query (et al) from PHP, you DON'T specify the semicolon (;) at the end of a query. If you want to import this back into MySQL, do the following: 1. Go into mysql and recreate the database manually -- the dump from mysqldump does NOT have a command to recreate the db. 2. Run "mysql < textfile.sql", where textfile.sql is the dumpfile that was created. Be sure to use the -p option if you need to specify a password. Good luck. -bsh steven wrote:
I'm moving a mySQL db from my own server over to an external hosting company. there I don't have any root access of course... so I log in the mySQL-console. I made a 'db-dump' of my mySQL db (with Webmin), so I've got a textfile with a large amount of SQL-statements inside. (CREATE TABLE and INSERT INTO's) I tried the usual connection to the db, and then: @mysql_db_query('dbname', $myQ, $lid); where $myQ is a string of the whole textfile. I get this error: 1064You have an error in your SQL syntax near '; INSERT INTO ISshipping VALUES (8,'966637132','EWW','Emery Worldwide','EWW93' at line 20 it seems as if the first sql-statement is ok, but the query command from php can't handle multiple statements devided by the ';'... How can I import the whole file? tnx for any help!
-- ======================================================================= Billy S Halsey Software Problem Resolution ESP Solaris Software Email Billy.Halsey@Sun.COM Sun Microsystems, Inc -NO DAY BUT TODAY- =======================================================================

« previous php.db (#17126) next »