26 Aug, 2011
Move/Transfer/Copy MYSQL database from one PC to another in Windows
The standard way to copy one database from one computer to another will be to backup using MSQL administrator from the source computer and then restore them onto the destination computer using the similar tool. However, if you have 10 or more databases to transfer, that will be pretty troublesome, isn’t it? There’s another situation where you can use the following method for transferring the database especially when your source computer is already dead and you only have a working harddisk with the MYSQL databases in it.
So here, I am going to show you how to move, transfer or copy MYSQL databases from one computer to another in Windows in the quickest way. The only requirement is that you have to be an administrator, so that you can access Document and Settings folder or the Program Files folder.
- Open Window Explorer (Windows Key + E) or Open My Computer at the source computer
- Depending on where you have set your data folder during the MYSQL installation, you will have to go that same location. If you do not know where it is, read How to find MYSQL database files in Windows.
- Once you located the data folder, you see one or more folders named after your database name. Copy all the folders and the ibdata1 file. DO NOT COPY THE ib_logfile(x) files and anything else!
- Go over to the target computer, Open System Services. (Type services.msc at the Windows menu “Search Program and files” entry box and press <ENTER>)
- On the right panel of the Services window, scroll along the list and look for the name “MYSQL“. Select MYSQL and right mouse click and click <STOP>. Once it has stopped, you will it’s status become blank instead of <Started>.
- Similarly look for the location of the data folder. Once you located it, I recommend you back up the folder or just rename it. Paste over the folders and ibdata file you have copied from the source computer to the data folder. Overwrite all files or folders when prompt.
- Go back to the Services window and select back MYSQL. Right mouse click on it and click <Start> to resume the MYSQL service.
- Open MYSQL administrator and log on to your database server and you should be able to see your transferred database together with their data.