Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Move databases from server to server


  • Please log in to reply
6 replies to this topic

#1 KamakaZ

KamakaZ

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:02:29 AM

Posted 14 July 2009 - 10:39 PM

Hi,

not sure whether this should be in this forum or the linux one, but here we go...

I have inherited a linux server (Fedora 9) and have root access, we have just prepared a new web server (Fedora 11). The old server has only one website on it as of the moment, but we are looking to retire it. I'm pretty sure it has a database on it as customers must enter data into the website at the end of every month, just don't have any ideas as to what the database is or where it is.

I suppose i could check the PHP on the login section of the website to start.

I have found this command used in mySQL, and think i could manage to use it to export the database (if it is a mySQL database) - mysqldump -u DBUSER -p DBNAME > DBNAME.sql

On the other end i have installed phpmyadmin (which has a GUI YAY!) so it shouldn't be a problem importing it.

Any idea's on how to find out what database program is installed and what databases/tables are in it?


Cheers,

KamakaZ

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


BC AdBot (Login to Remove)

 


m

#2 Romeo29

Romeo29

    Learning To Bleep


  • BC Advisor
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:10:29 AM

Posted 15 July 2009 - 01:25 PM

Create a PHP page with
<?php
phpinfo();
?>

Load it in browser with address like http://localhost/page.php. Or from another computer give proper address accordingly.

Look what extensions are being loaded. Some of them would be database extensions like mysql, postgresql, firebird etc. Those servers are being used.

what tables are in a db, can be found out using that rdbms related command. For example, in mysql, you issue command like this:
mysql -u root -p password
mysql > show databases;
it will display all databases.

Here you have to supply root password or if you have another user access, supply ur username after -u and password after -p.
I dont know much about other rdbms.

Edited by Romeo29, 15 July 2009 - 01:28 PM.


#3 KamakaZ

KamakaZ
  • Topic Starter

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:02:29 AM

Posted 16 July 2009 - 06:02 PM

ok, so i have found the databases, now i know the names of them, i can just do a mysqldump and then ftp them to the new server?

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


#4 Romeo29

Romeo29

    Learning To Bleep


  • BC Advisor
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:10:29 AM

Posted 16 July 2009 - 08:05 PM

Yes. Just dump into a file and load the file on new server.

For dumping:
mysqldump --all-databases -u root -p > databases.sql

For loading this dump file back in new server:
mysql -u root -p databases.sql

Edit : Play it safe. Make backups on both servers :thumbsup:

Edited by Romeo29, 16 July 2009 - 08:17 PM.


#5 KamakaZ

KamakaZ
  • Topic Starter

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:02:29 AM

Posted 16 July 2009 - 10:13 PM

will do, i have had to format a reinstall the new server, so i'll post back when i'm ready again? thanks for your help thus far!

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


#6 KamakaZ

KamakaZ
  • Topic Starter

  • Members
  • 739 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Victoria
  • Local time:02:29 AM

Posted 19 July 2009 - 10:04 PM

Just to let you's know...

I formatted the server, configured apache, mysql etc...

But for backing up the databases i did it a little differently. Firstly i ran the show databases command, picked the database i wanted then ran the mysqldump command ftp'd it to my new server and ran the mysql -u root -p < database.sql which worked only if there was a database with the same name already in mysql.

But, all is up and going now, only have to hope for a smooth transition to the new server this weekend.

Thanks for your help! :thumbsup:

There's no place like 127.0.0.1
There are 10 types of people in the world, those that can read binary, and those who can't.


#7 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:09:29 AM

Posted 20 July 2009 - 07:46 AM

The way to add a database is to use source <path to backup> within mysql. Then you don't need to add the tables yourself. You need to check and make sure the aapplications will work with the new database because permissions do not transfer. If the web-app uses a specific user name with a specific password, it has to be added also.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users