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:
- Download and Install XAMPP
- Start Apache and MySQL Modules in XAMPP
- Access phpMyAdmin in a Web Browser
- Create MySQL Database in phpMyAdmin
- Create New Table in MySQL Database
- 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.
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.
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:
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:
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.
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.
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.
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.
We now have a database with a users table that is ready to use and is linked to the website.
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.
We can go back to the users table and see if the data entry was successful. It will look something like this:
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.
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!
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!
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!
How can I find out more about it?
You helped me a lot by posting this article and I love what I’m learning.
Thank you for your articles. They are very helpful to me. Can you help me with something?
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!
You helped me a lot with this post. I hope you continue to write excellent articles like this.
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!
Keep working ,terrific job!
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.
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!
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!