Re: [PHP-DB] Using PHP to import a DB

2005-11-06 Thread Todd Cary

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:[EMAIL PROTECTED] 
Sent: Sunday, November 06, 2005 8:57 AM

To: php-db@lists.php.net
Subject: Re: [PHP-DB] 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: 
1 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',2004052332);

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:[EMAIL PROTECTED] 
Sent: Saturday, November 05, 2005 4:02 PM

To: php-db@lists.php.net
Cc: Chris Herron
Subject: [PHP-DB] 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



RE: [PHP-DB] Using PHP to import a DB

2005-11-06 Thread Robbert van Andel
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:[EMAIL PROTECTED] 
Sent: Sunday, November 06, 2005 8:57 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] 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: 
1 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',2004052332);

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:[EMAIL PROTECTED] 
> Sent: Saturday, November 05, 2005 4:02 PM
> To: php-db@lists.php.net
> Cc: Chris Herron
> Subject: [PHP-DB] 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

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



RE: [PHP-DB] Using PHP to import a DB

2005-11-06 Thread Robbert van Andel
Yes, this is an upload of a local file.  I'm not sure if there is a way to
run the sql command inside the file if it's sitting on the server.  Keep in
mind that you may run into size upload restrictions (i.e. files larger than
2 megs, or whatever your webhost has set it to).  If that's the case, you
can separate out the sql commands from the file into separate files.  

-Original Message-
From: Todd Cary [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 06, 2005 8:43 AM
To: php-db@lists.php.net
Subject: Re: [PHP-DB] Using PHP to import a DB

Robert -

I installed phpmyadmin on the shared server, however I am not sure of 
the command to run the sql file, mybackup.sql, that was created on the 
dedicated server with mysqldump.

The docs as best as I can read them indicate that all I need to type 
into the "Run SQL query" text box is the name of the file 
("/tmp/mybackup.sql"), however that produces an error.

Maybe the problem is that I FTP'd the file to the shared server and it 
should be on my local computer??

What have I overlooked?

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:[EMAIL PROTECTED] 
> Sent: Saturday, November 05, 2005 4:02 PM
> To: php-db@lists.php.net
> Cc: Chris Herron
> Subject: [PHP-DB] 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

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



Re: [PHP-DB] Using PHP to import a DB

2005-11-06 Thread Todd Cary

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: 
1 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',2004052332);

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:[EMAIL PROTECTED] 
Sent: Saturday, November 05, 2005 4:02 PM

To: php-db@lists.php.net
Cc: Chris Herron
Subject: [PHP-DB] 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



Re: [PHP-DB] Using PHP to import a DB

2005-11-06 Thread Todd Cary

Robert -

I installed phpmyadmin on the shared server, however I am not sure of 
the command to run the sql file, mybackup.sql, that was created on the 
dedicated server with mysqldump.


The docs as best as I can read them indicate that all I need to type 
into the "Run SQL query" text box is the name of the file 
("/tmp/mybackup.sql"), however that produces an error.


Maybe the problem is that I FTP'd the file to the shared server and it 
should be on my local computer??


What have I overlooked?

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:[EMAIL PROTECTED] 
Sent: Saturday, November 05, 2005 4:02 PM

To: php-db@lists.php.net
Cc: Chris Herron
Subject: [PHP-DB] 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



Re: [PHP-DB] Using PHP to import a DB

2005-11-06 Thread Tim Van Wassenhove
On 2005-11-06, Todd Cary <[EMAIL PROTECTED]> wrote:

>> system("mysql -u user -p db < /tmp/mydb");

> With the "-p" switch, the user is asked for the password.  How does that 
> happen with the system command?

Don't leave a space between -p and the password
mysql -u user -pyourpassword -h somehost db < /tmp/mydb


-- 
Met vriendelijke groeten,
Tim Van Wassenhove 

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



Re: [PHP-DB] Using PHP to import a DB

2005-11-05 Thread Micah Stevens

Don't use it, use --password= instead.. 

The downside to this is that anyone can see your password in the process list, 
but I'm going to hazard a guess that no users are scanning the process list 
that often on a shared webserver. 

-Micah 

On Saturday 05 November 2005 5:21 pm, Todd Cary wrote:
> Micah -
>
> With the "-p" switch, the user is asked for the password.  How does that
> happen with the system command?
>
> Todd
>
> Micah Stevens wrote:
> > system("mysql -u user -p db < /tmp/mydb");
> >
> > On Saturday 05 November 2005 4:02 pm, Todd Cary wrote:
> >>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



Re: [PHP-DB] Using PHP to import a DB

2005-11-05 Thread Todd Cary

Micah -

With the "-p" switch, the user is asked for the password.  How does that 
happen with the system command?


Todd

Micah Stevens wrote:



system("mysql -u user -p db < /tmp/mydb");



On Saturday 05 November 2005 4:02 pm, Todd Cary wrote:


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



RE: [PHP-DB] Using PHP to import a DB

2005-11-05 Thread Robbert van Andel
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:[EMAIL PROTECTED] 
Sent: Saturday, November 05, 2005 4:02 PM
To: php-db@lists.php.net
Cc: Chris Herron
Subject: [PHP-DB] 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

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



Re: [PHP-DB] Using PHP to import a DB

2005-11-05 Thread Micah Stevens



system("mysql -u user -p db < /tmp/mydb");



On Saturday 05 November 2005 4:02 pm, Todd Cary wrote:
> 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



[PHP-DB] Using PHP to import a DB

2005-11-05 Thread Todd Cary
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