Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In another video, we showed you how to backup your Drupal site in two steps. First, by copying all the files in your Drupal folder, and secondly by backing up the database. For a backup doesn't do you any good if you can't restore from it. So we will show you how to do that in this video. You should create a backup of your site first, by following the instructions in that earlier video, since we will be using them here. To get started we are going to do something dramatic. We are going to go into our Drupal folder, and delete everything there. We go into the Macintosh HD, and Users, and tomgeller, this is where we happen to have our Drupal site, but of course, yours might be somewhere else on your computer.
Go into sites, Drupal, and I am just going to let's say, get rid of some random files here. And they are gone. Now let's go back into our site, and see how well it faired. We go to http:// localhost, and we can't see -- you know, we can see the individual files that are left, but we don't see our Drupal site obviously. So let's go back to the Finder, hide everything, and restore from the file that we had saved. Fortunately I still have those files from when we had exported our database and saved the files earlier, here on our desktop. I am going to get rid of everything that's in our Drupal folder. My personal preference is to just get a clean slate and then start again from the beginning. That also means of course, that when you backup, you have to save everything from your Drupal folder.
If you decide to only save certain folders, and certain files inside the Drupal folder, of course, your procedure will be somewhat different. But for us I am going to say Command +A or Ctrl+A if you are using a PC, drag it to the trash, and empty it, and it's gone. We had saved our files into a Drupal folder which we then compressed. I am going to uncompress that now, and to restore the files, all that we have to do, is take everything there, again Command+A or Ctrl+A, drag it back in, and puff. I'll reload this page, and it works again.
What if something happens that destroys your SQL database? I am going to go into phpMyAdmin, and do exactly that. To do that in MAMP or WAMP, we go to our start page in phpMyAdmin. Go into our Drupal database, and let's just delete a few random tables here. And we selected, we just say, drop. Yes, I really do want to do that, I really do want to do it on my site. I'll create a new Window, and take a look and see whether our site is actually running, as a result. Now we have too many errors here. So we are going to do something very similar in the MySQL database that we did in the files. I am going to go into this database and just get rid of the entire thing.
Fortunately remember, we did make a backup, don't do this obviously if you didn't make a backup. I do want to drop it, I will say, OK. Now, I am going to go back to the Finder, find where that SQL database is, it's right here on our desktop. Go back in here, and now instead of using export, we are going to use import. From here we can choose the file that we want to backup from, by clicking on Choose File, and there is my drupal.sql file, Choose, and then just scroll down to the bottom, and say Go. If everything goes well, you will get a message like this. If it doesn't, you'll see a red box appear, and it will explain the errors. In that case, you may have some troubleshooting to do. I would suggest the first thing you do, is try once again dropping the database, and try re-importing it. But let's take another look at our site, and see if it actually works. We just go to localhost, and we are back, our site is actually working. We can administer it, we can see all of our content, and everything is fine.
You now know how to backup and restore your Drupal site, which will save you a lot of problems. The last step in this process is the one where most people trip up, which is the actually make those backups on a regular basis. I would suggest if you have a busy site, at least once a week, they don't take up very much space, and the trouble that you save is enormous.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.