Forum Moderators: phranque

Message Too Old, No Replies

MySQL Help

         

NetGoonie

5:01 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



I have a link directory using a php script and MySql database....there is already data in the db but I am moving to a new link directory script which will mean a new database.

Question...what is the best (and easiest) way to get "select" data from existing db into the new db in their appropriate locations? **note: not all current info will be tranferred over to the new one and the tables with the new one will be different from the current.

I've never done this before...

thanks

coopster

6:48 pm on Aug 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, NetGoonie.

As you can imagine there are a few options depending on the size and quantity of tables. One of the more forthright approaches would be to use mysqldump [dev.mysql.com] to dump the databases and then use the same utility to import them to the new database. You could then run INSERT ... SELECT [dev.mysql.com] to move the appropriate columns to the new structure.

wheel

9:06 pm on Aug 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



more specifically, here's what I do from a command prompt:

mysqldump -u username -p database_name -a -B>dbase.dump

that creates a text file called dbase.dump that contains all the neccessary mysql commands to recreate the database.

On the new server:
mysql -u username -p<dbase.dump
which will reinsert the data back into the database.