Skip to main content
How to Create a MySQL Database With XAMPP

How to Create a MySQL Database With XAMPP

Many people start by creating a database on their local computer before building a website. The database is then uploaded to the web hosting service. But first, how to create a MySQL database?

Relax, we’ll find the solution in this article. This time, we’ll walk through six simple steps to create a MySQL database on localhost using XAMPP’s phpMyAdmin.

Follow the full explanation below right away!

How to Create a MySQL Database on Localhost

We can practice creating a MySQL database on localhost by taking the following six simple steps:

  1. Download and Install XAMPP
  2. Start Apache and MySQL Modules in XAMPP
  3. Access phpMyAdmin in a Web Browser
  4. Create MySQL Database in phpMyAdmin
  5. Create New Table in MySQL Database
  6. New Data Input in MySQL Database Table

Let’s start from the first step how to create a MySQL database!

1. Download and Install XAMPP

The first step in creating a MySQL database on localhost is to install XAMPP. Please Download XAMPP from the official website. Choose the installer for our operating system, then click the Download button.

Download XAMPP
Download XAMPP

The download time is determined by the speed of our internet connection. If XAMPP was successfully downloaded, double-click the installer file to begin installing XAMPP. Learn more about How to Install XAMPP on Windows (Easiest!).

If XAMPP is already installed, we can move on to the next step in creating a MySQL database.

2. Start Apache and MySQL Modules in XAMPP

If XAMPP is already installed, launch the application to continue learning how to create a MySQL database. We will see five modules installed: Apache, MySQL, FileZilla, Mercury, and Tomcat.

Typically, we only need to run two modules to create a website: Apache as the web server and MySQL as the database.

XAMPP Control Panel
XAMPP Control Panel

Click the Start button for Apache and MySQL to access phpMyAdmin and create a database. If it was successful, the appearance of XAMPP will change as shown below:

Starting Apache and MySQL
Starting Apache and MySQL

3. Access phpMyAdmin in a Web Browser

We then use a web browser to access phpMyAdmin. You can get to it by typing http://localhost/phpmyadmin into the web browser’s search field. Remember to hit the Enter key. The initial phpMyAdmin display will then look like this:

phpMyAdmin Page
phpMyAdmin Page

On this page, we can manage our website’s database. For example, creating databases, editing, deleting, and even querying data.


Related post: How to Import MySQL Database in phpMyAdmin Easily


4. Create MySQL Database in phpMyAdmin

Click New to create a new database in phpMyAdmin.

New Database in phpMyAdmin
New Database in phpMyAdmin

In the provided column, type the name of the database. In this tutorial, the database name to be created is sribuhost_db. If a name has already been assigned, click Create button.

New Database Form in phpMyAdmin
New Database Form in phpMyAdmin

Later, the newly created database will appear on the left side of the phpMyAdmin page. We have now created a new database with success. Then, in the new database, we can add a table to store data.

5. Create New Table in MySQL Database

Now, with users as the table name, we will create a table with four columns for user data. Then, click the Create button.

New Table in MySQL Database
New Table in MySQL Database

We must enter column names and data types in this section. We add id, name, email, and address columns to the users table. Check that all of the settings match the image below, then click the Save button.

Table Structure Form in MySQL Database
Table Structure Form in MySQL Database

We now have a database with a users table that is ready to use and is linked to the website.

Table Structure in MySQL Database
Table Structure in MySQL Database

Related post: Login Form PHP MySQL With Session


6. New Data Input in MySQL Database Table

Now that you’ve created a new table, it’s time to populate it with data. It’s really simple. Take the following steps:

First, on the top toolbar, select the Insert menu. Fill in the data based on the field name, email, and address. The id field is left blank; the autoincrement in this field will fill it in automatically. Once you’ve completed these fields, click the Go button.

Insert New Data in MySQL Database Table
Insert New Data in MySQL Database Table

We can go back to the users table and see if the data entry was successful. It will look something like this:

All Data in MySQL Database Table
All Data in MySQL Database Table

How to Make a MySQL Database Very Easy Right?

That’s how to use phpMyAdmin to create a MySQL database on localhost. To gain access to phpMyAdmin, we must first install XAMPP.

Managing and creating MySQL databases is simple with XAMPP’s phpMyAdmin. If you have any questions about the tutorial above, please leave them in the comments section.

Hopefully, this article will add to our understanding. Thank you very much.

Share this

Shafy Gunawan

I’m a web developer. I spend my whole day, practically every day, experimenting with HTML, CSS, JavaScript, and PHP; dabbling with Python programming language; and share the knowledge that I learned.

13 thoughts to “How to Create a MySQL Database With XAMPP”

  1. That is very fascinating, You’re a very skilled blogger. I have joined your rss feed and look forward to seeking extra of your excellent post. Also, I’ve shared your site in my social networks!

  2. Hey there! I could have sworn I’ve been to this website before but after checking through some of the post I realized it’s new to me. Anyhow, I’m definitely glad I found it and I’ll be bookmarking and checking back frequently!

  3. A powerful share, I simply given this onto a colleague who was doing slightly analysis on this. And he actually bought me breakfast because I discovered it for him.. smile. So let me reword that: Thnx for the treat! But yeah Thnkx for spending the time to debate this, I feel strongly about it and love studying more on this topic. If potential, as you turn out to be expertise, would you mind updating your weblog with extra particulars? It’s highly useful for me. Huge thumb up for this blog post!

  4. Good web site! I truly love how it is easy on my eyes and the data are well written. I am wondering how I could be notified whenever a new post has been made. I’ve subscribed to your RSS which must do the trick! Have a nice day!

  5. Hey there this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding skills so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

  6. I was just searching for this info for some time. After 6 hours of continuous Googleing, at last I got it in your website. I wonder what’s the lack of Google strategy that do not rank this type of informative sites in top of the list. Normally the top web sites are full of garbage.

  7. My brother recommended I might like this blog. He was totally right. This post truly made my day. You can not imagine simply how much time I had spent for this information! Thanks!

  8. Hey! I’m at work surfing around your blog from my new iphone 3gs! Just wanted to say I love reading your blog and look forward to all your posts! Carry on the great work!

Leave a Reply

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