Home
Web Master Resources
Support Forum
Support Forum
SMF Themes
SMF Themes
Tiny Portal Themes
Tiny Portal Themes
SMF Tutorials
Simple Machine Tutorials
Web Design
Web Design
Tutorials
Web Desig tutorials
Themes and Templates
Themes and Templates
Articles
Web Master Articles
PHP and Java Snippets
Php Code
Graphics and Clip Art
Free Graphics and Clip Art
Forum Software
Forum Software
Web Hosting
Web Hosting
Web Tools
Web Tools
Web Directory
Web Directory
Meta Tag Generator
Meta Tag Generator
Services Offered
Services Offered
Our Network Sites
Networks
Link To Us
Link To Us


Support Our Site

paypal

 


Users Online

Moving An SQL Database
How To Move AN SQL Database From One Server To Another

This will be a great help is you have anything large, like a forum and/or CMS using SQL if you need to move from one place to another. In this article, we'll find out a bit about moving a SQL database from one server to another using cPanel, phpMyAdmin and a text editor. The purpose for this is to keep a backup and to be able to leave one host and move to another seamlessly without users knowing anything happened. You will need your cPanel username and password and know the server path from both the new and old server. It looks something like this >>> /home/username/public_html, this is how the database directs requests from your website users. If you are moving to a different version or different SQL program, that is outside the scope of this article and you'll need to consult the programmers website or your webhosts.
An Important Note:
Most of what I'm describing is common to current installations of cPanel and phpMyAdmin but some of position of links or buttons may be different from what you have. In this case, you'll have to use intuition and common sense to do what is described with what you have.
cPanel version - 10.9.0-CURRENT-117
phpMyAdmin - 2.9.0.2
Running on Unix if that all matters to you.
Getting A True SQL Copy
On the old server you are moving FROM, go to cPanel. From there,  you should have options for Back Up, phpMyAdmin and MySQL Databases.
Back Up
is just what it sounds like, from there you can back up both files and databases. You cannot use this copy most of the time, slightly different versions of cPanel and whatever is used in the restoration process can cause compatibility conflicts. THIS IS NOT THE ONE WE ARE WORKING WITH!
MySQL Databases is where you created your database and users. Again, THIS IS NOT THE ONE WE ARE WORKING WITH!
phpMyAdmin is a link to a separate program on the server called "phpMyAdmin" that lets you mange and manipulate your database(s) manually. THIS IS THE ONE WE ARE GOING TO USE!

Once you click the link for phpMySQL, it will probably open a new window. There are two frames that make up this page, a skinny one on the left and a larger frame on the right. On the left is a drop down box labeled "Database". No matter how many you have, use the drop down box to select the data base. It should flicker and eventually open a list of what tables are in the database. When the list of tables appears on the left another window will open on the right, if the window on the right doesn't also reload and show a list of the tables, you'll need to click on the name of the database above the list of tables on the left to load the list on the right. Sounds confusing, I know, but do it just like that and it works.

Next, above the table on the top right, there are tabs labeled Structure, SQL, etc... Choose the one labeled "Export". When the next window loads, it should have a list of your tables in a scrolling box. In my version of phpMyAdmin it's in the top left corner of the right side frame. It has a link labeled "Select All", click it, it should highlight the list or show you it has selected them somehow. Generally speaking, doing this creates an SQL file by default so all the other settings are for advanced users. Find the "Go" button. Click that.

The page that loads make take a minute or two depending on how big your database is or how fast the host is. What comes out is the database in text format, SQL format. In the text box, right click and select all, copy the text and open a text editor. A simple one is best. WordPad does good because it doesn't alter the test and has a "Replace All" feature. Paste The Data text into the editor.

TIP: When you move to the new server, create a database as closely to the configuration to the original as possible so you don't have to change any configuration files in your website programs, forums or CMS using the SQL database.

Modifying SQL Database To New Server
Find the location of an old server path in the text, using the find feature for your username is usually the easiest and most common way web hosts create hosting accounts. Once you locate the old server path, do what ever your text editor requires to replace this text. In WordPad, you highlight the text to be replaced, go to the "Edit" tab and select "Replace All". It automatically has the text to be replaced and you only need to enter the new server path in the lower window. Once there, click "Replace All" and that's about it. Save the file as a plain text (.txt) file but name it with the .sql extension, type the whole thing in as the filename and it will make it that type of file.

If you are moving to or using a copy for a new domain name, you may need to replace those in the data file also.

I always like to double check my paths and use the find feature to hunt out any instances of an old path, but usually they are all knocked out the first time you replace it.

Lastly, the easy part, uploading the new version of the database to the new host...and you have two options.
YOU SHOULD HAVE ALREADY CREATED A NEW DATABASE TO FILL.
The First method, the one I use most is to go into the phpMyAdmin like before, select the tab "SQL" on the top, then it opens a window with a large text area. I paste a copy of the new version into this then hit "GO". This runs the commands and loads the information from the file. It takes a while to load sometimes so be patient. Once it's done, it will confirm or show errors. Also, the frame on the left should reload with all the tables you just added. If it doesn't, click the drop down box and choose the database again and see if it loads up then.
The second way is to select "Import". From this screen, there should be a "Browse" button next to a text box. It looks like a search box, but it let's you look into your files and select the SQL database text file you created. Select it, Click "Open", then find the nearest "Go" button. This method will take just as long as the other, but can time out on some hosts if it is too large. As in the first example, once the information is loaded, the new tables should be showing on the left and maybe on the right.

Final Notes And Trouble Shooting
If you get an error after trying to load your data from the SQL database, go back to the main screens like you are starting over. Some servers show a time out error for no reason when the information transfer was actually successful. If you see the tables and the new site works, then you got it.

If your server times out or get errors because the text file or data you pasted at the new server is too large, you'll need to use the first method from above. Go into the new text file and grab sections of the database information to load at a time. Usually, splitting it in half, or close to it, should solve the problem. It's obvious how you should grab the information to paste, it's clearly marked where the table information begins and ends, just select text up to a break between tables and copy that, then the other half.

If the versions of phpMyAdmin are too different, you may need to go back to the first step of getting a copy of the data base and finind a selection that makes a copy compatible to your version.

Well , that's about it for now.  I'm sure that I raised some questions and didn't provide nearly enough answers. You can post further questions in the forum and get specific answers that way.

Keep It Str8!

 

 

Site Copyright RebelRose Networks © 2006-2008 All rights reserved
  Privacy Policy, Contact Us, Copyright Notice, Advertising, Site Map

About Your Credit - Financing-Refinance - Health Care Info - Weight Loss - Health Care Services - Web Master Atricles - Web Hosting
SMF-Tiny Portal Themes - Web Design - SMF Directory - Web Master Resources - Relationships - Online Shopping
Personal Loans - Loans - Debt Consolidation - Credit Counseling