PDA

View Full Version : Best way to copy a really huge table


markhartnady
03-24-2004, 06:11 PM
I have a really huge table that I need to copy however using the Export function in MySqlAdmin does not work because it "times out". All I really need to do is generate an SQL script that will, drop the table if it exists, create the table and its structure, and then insert the data line by line.

Usually when you perform a command in MySqlAdmin through Internet Explorer the MySQL command line is displayed with the results. However, this does not happen when you export.

Anyone know how to do this from the MySQL command line?

In a nutshell: I need to backup a table to an SQL script file.

raf
03-25-2004, 09:34 AM
phpmtadmin is just a bunch of ugly php pages. Which means that every query goes over the webserver, and that the webserver waits for a response while the mysql-server is executing.

So the easiest way to solve your current problem and do some efficient db-management in general, is to use a non-web db-frontend. like MySQL Front or many others.

It doesn't matter if you would click a button on a phpmyadmin page, or type in the query, or embedd the sql-statement somewhere in your php-code --> the command will be sent over the webserver and will take exactly as long and your script will still timeout.

I didn't check phpmyadmins command, but you can start reading here
http://www.mysql.com/doc/en/BACKUP_TABLE.html
and follow the links to find the most eficient way.

Which command to use depends on the sort of access that you have to the mySQL servers.

silent11
03-26-2004, 09:30 PM
mysqldump