Re: Using PHP to import a DB

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

 



Robert -

I created and loaded the tables by brute force. That is, I took each of the CREATE TABLE statements from the mysqldump file and executed them in the phpmyadmin SQL query area and then did the same for the INSERT commands.

Not what I am use too with a dedicated server though :-) !!

I bet it is a filesize problem...I'll look into that.

It appears that I'll have to use the DUMP or SELECT * INTO OUTFILE ... for each table for a backup. Not as convenient as the mysqldump command! Unless I can get the php system() to work.

Many thanks for holding my hand during this learning process....

Todd

Robbert van Andel wrote:
Do you have permission to create tables (I would assume so)?  Can you run
any successful queries (i.e. not using the file upload)?  If so, you might
need to check your configuration file, or you might have some file size
limitations, as I mentioned in my previous email.

-----Original Message-----
From: Todd Cary [mailto:todd@xxxxxxxxxxxxxxxxxx] Sent: Sunday, November 06, 2005 8:57 AM
To: php-db@xxxxxxxxxxxxx
Subject: Re:  Using PHP to import a DB

Robert -

I used the backup file on my desktop computer and the browse button. After the upload was over, I got this message:

Your SQL query has been executed successfully:
The content of your file has been inserted. (sfyc_data_20051105.sql: 11111 Instructions)

However the tables were not created in the DB. I must be missing something simple here!

A sample of the backup file is as follows:

CREATE TABLE ACCESS (
   AC_REF int(11) NOT NULL auto_increment,
   AC_MEMBER_NUM varchar(10) default NULL,
   AC_TYPE varchar(15) default NULL,
   AC_CHANGETIME timestamp(14) NOT NULL,
   PRIMARY KEY  (AC_REF)
) TYPE=MyISAM;

--
-- Dumping data for table 'ACCESS'
--


INSERT INTO ACCESS VALUES (2230,'441','VIEWMEM',20040521111332);

Todd
Robbert van Andel wrote:

You could run a system command from the web browser to import the text

file.

If you have access to PHPmyAdmin, you could use it to then import the

file.

Or finally, you should be able to read the contents of the file into a
variable (if it's small enough) and then run the query using mysql_query.

My personal preference is phpmyadmin.  It's a very good database interface
and can be retrieved from http://www.phpmyadmin.net/home_page/

Robbert van Andel
-----Original Message-----
From: Todd Cary [mailto:todd@xxxxxxxxxxxxxxxxxx] Sent: Saturday, November 05, 2005 4:02 PM
To: php-db@xxxxxxxxxxxxx
Cc: Chris Herron
Subject:  Using PHP to import a DB

My client switched from a dedicated server to a shared server, so I cannot use the command line to import a DB that was produced with mysqldump. Can I duplicate "mysql -u user -p db < /tmp/mydb" with php?

Any suggestions are greatly appreciated....

Todd




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