How to Import SQL Into Your MySQL Database Via phpMyAdmin

If you followed my tutorial on making a MySQL database in Cpanel, you may have noticed at the end of that tutorial that I talked about populating your database with tables and data. Oftentimes, when you’re installing a script, the developer of the script will either provide you an installation page that does all of the heavy lifting for you OR you’re left to figure out what to do with the sql schema they give you. This tutorial will take you step by step through importing the sql into your database.

If, on the other hand, you missed out on that tutorial and are just trying to figure out how to import your SQL schema into your MySQL database via phpMyAdmin, this tutorial should also help you get that squared away! Please note that this tutorial assumes that you use Cpanel to access phpMyAdmin. If you don’t have Cpanel, then you may have to access phpMyAdmin differently than shown in this tutorial (which sadly is outside the scope of this particular tutorial.)

And with all of that said, let’s get started!

1) If you followed my MySQL database tutorial, then you’ll recognize the following screenie:

As before, you’ll want to navigate to the ‘Databases’ section of Cpanel. This time, you want to click on the third icon, ‘phpMyAdmin’.

2) I have Host Gator webhosting so sometimes this screen will pop up before it actually goes to phpMyAdmin. (Totally normal and usually doesn’t take long.)

3) Next, you will see the main phpMyAdmin page. It’ll look like this (instead of an italicized ‘l’, you should see your account name.)

In the upper left corner below ‘Recent’, you’ll see a folder icon with a plus on the left side of it and your account name on the right side of it. Click on the plus sign to expand the database listing.

4) You’ll next see something like this:

If you have a ton of databases like I do, you’ll have a long listing like what’s pictured. In this example, we want to find and click on ‘l_testdb’ at the bottom left. In your case, pick the database you need to import the sql into.

Note: My database listings are purposely blurred out for security reasons. In your case, you should see the text for your database listings (if you already have any databases.)

5) Once you click ‘l_testdb’ on the left side of the screen (or whatever database you’re working with), this will show up on the right side:

Since the tables haven’t been populated yet, it tells you simply ‘No tables found in database.’

6) There are two options to import your SQL. You can either import the file itself. To do so, you click on the Import tab which shows you this page:

Next, you click ‘Choose File’ and navigate to where you have the SQL file stored on your computer. It should be an SQL file (which in most cases, it is.) Keep SQL as the Format if that is the case. Then click ‘Go’.

7) The other option is to manually enter (or copy and paste the SQL.) To do that, click on the SQL tab and you’ll see something like this:

You’ll see in this picture that I’ve already entered the SQL schema. I also show that text magnified in case you want to read it. In your case, either type up the SQL or copy and paste the contents of the SQL file that was provided to you into the window. Once done, click ‘Go’.

8) Both options should result in a page that looks like this:

When you see the green check mark and accompanying message, it tells you that the SQL schema ran successfully. If it doesn’t run successfully, it’ll show an error message instead.

9) With that completed, you can now check out the new structure of your database by clicking on the Structure tab. In this example, it ends up looking like this:

Success! The database has been propagated with its first table.

When you’re first learning to do stuff like this, it can be a bit intimidating, but it’s really quite easy to do once you know how to do it. I hope that this tutorial helped you. If you have any questions or comments, please leave them in the comment section below.

If you would like to check out my tutorial on how to make a MySQL database in Cpanel, click here!

If you found this post useful, leave a comment below!

Leave a Reply

Your email address will not be published. Required fields are marked *