If you have used the Backup module on Drupal to backup up your site, then inside to the tar.gz file which contains all the web files, there will also be a slq.gz file which is a compressed version of your database.
One way to import this is using phpmyadmin. Simple go to the database you have created, and chose import, speificy the file, and hit “go”. However, there are often problems with phpmyadmin when importing larger files, i.e. it fails. If the import is successful, then it should report something like:
Import has been successfully finished, 630 queries executed.
However it has been known that for some larger files for php to fail. One thing that is often required is to increase the maximum upload file size in the php.ini configuration file. I have set my php upload file size to 26Mb, which is currently enough still; the last database that I uploaded using phpmyadmin was less than 2Mb. However, some popular, older site can have very large databases. For these, it may be better to use the mysql command line to import. I will go further into that later, once I have mastered the process myself.
For now, assuming that you have successfully inported the Drupal database using phpmyadmin, you should now have a copy of your Drupal installation. With this. you can install new modules, test, play, and upgrade, all without risk to harming your live version.
The main reason that I set out to make a copy of my Drupal installation was to then upgrade it, and check everything is working. There have been security warnings regarding older version of Drupal (5.2 is prone to MySQL attacks) and therefore I want to upgrade to 5.7. However, I did this for a new site (I actually built it using an old 5.2 download, then upgraded) but the forums failed to work afterwards. Something to do with MySQL settings / tables. I cannot afford my forums to die on my main Drupal site, so therefore, I need to practice too.
In the meantime, it is nice to know that I have a method to totally renew my Drupal installation incase of hackers bringing the site down. Sometimes once a hacker has got their hands on you database it is not easy, or even impossible, to fix. Often the only option is to drop the database and rebuild from backup., so ensure no other rogue code is hiding, causing havoc.