Re: [PHP-DB] newbe: how to import a whole db from an .sql file

2002-02-21 Thread Billy S Halsey

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 [EMAIL PROTECTED]Sun Microsystems, Inc
   -NO DAY BUT TODAY-
===




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




[PHP-DB] newbe: how to import a whole db from an .sql file

2002-02-21 Thread steven

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!



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