How to Create a Database on Windows Using XAMPP and MySQL

How to Create a Database on Windows Using XAMPP and MySQL? Databases play a key role in most software developments. MySQL is one of the most preferred relational database management systems among these databases. There are several ways to create a MySQL database on the Windows operating system. However, the most common method is to do it with XAMPP.

What is XAMPP?

The XAMPP software package is a tool to create local host servers inside our computers. It is an open source, cross platform software that can be downloaded and installed for free. You can download this little companion on your Windows PC by simply going to this URL and proceeding to download. XAMPP is capable of performing a variety of tasks. You can start and stop the software in XAMPP by using the XAMPP Control Panel. 

One of the essential features of XAMPP is the ability to create a database in the MySQL format. It can be accomplished with the help of phpMyAdmin. This article will discuss what phpMyAdmin is and How to Create a Database on Windows Using XAMPP and MySQL. 

Features of XAMPP

  • Developers use XAMPP to test plugins and themes and monitor updates before going live. It helps them to catch any errors present in the implemented version.
  • XAMPP supports many modules, including WordPress, OpenSSL, Joomla.
  • Supports 3 main file formats ; .zip , .exe, .7z.
  • Have multiple components such as ; Apache , MariaDB, phpMyAdmin ,Webalizer ,XAMPP Control Panel ,Mercury, Tomcat, Filezilla ,OpenSSL ,Perl.
  • It is a beginner friendly solution package for full stack web development.
  • Saves time and manages configuration changes in various ways.
  • Handles admin tasks like checking the status and security.

Following in our article How to Create a Database on Windows Using XAMPP and MySQL is to introduce MySQL. 

What is MySQL?

MYSQL create database on windows

MySQL is an open source relational database management system. It is one of the big names in the industry of managing the extensive data ecosystem. Perhaps it is the most popular database that has been there to date. Founded 27 years ago by Michael Widenius in 1995, the first stable MySQL release was on May 23, 1995. MySQL is written in C and C++. By the way, a relational database is a computer based data collection system. 

Features of MySQL

  • MySQL is a user friendly tool that assists developers in building and executing local databases.
  • MySQL uses SQL ( Structured Query Language) for writing queries when performing CRUD operations ( Create, Read, Update, Delete).
  • MySQL is widely used in many famous companies and businesses such as Netflix, Pinterest, Airbnb, Uber, Twitter etc.
  • It is secure and easy to use ( it has solid data security layer).
  • It is scalable (MySQL supports multi threading).
  • It uses the Client/server model to support managing Relational database management systems.

What is phpMyAdmin?

You can run and manage MySQL through the internet using phpMyAdmin, which is free and open source software. The graphical user interface of phpMyAdmin makes it simple for users to exercise control over the database and monitor its activity. This interface is built using the PHP programming language. Due to the need for an internet solution for MySQL administration, phpMyAdmin has garnered significant trust and popularity over time. Both the phpMyAdmin control panel and direct SQL query execution are available to users when working with MySQL. It allows the admin to perform CRUD operations such as edit, create, drop, amend, change, and edit fields, tables, and indexes. Additionally, it is also used to grant privileges to exercise control over who can view specific data. In this way, phpMyAdmin is crucial for creating and managing a database.

Features of phpMyAdmin

  • Import data from CSV and SQL.
  • Exports data to various formats: CSV, SQL, XML, PDF and others by
    administering multiple servers.
  • Creates graphics of your database layout in various formats.
  • Creates complex queries using Query by example (QBE).
  • Searching globally in a database or a subset of it.

Create a Database on Windows Using XAMPP and MySQL

STEP 1 :  First, find the XAMPP program on your computer and double click on it. It will open up to the XAMPP control panel. As you can see the control panel now, you may use it to start or stop the functioning of any server by clicking the corresponding buttons. In the second step of the process, click the “Start” buttons to launch the Apache and MySQL servers on your Windows computer. The user will be able to view the below window when they start to run.

STEP 2 :  Then, choose the MySQL module and then switch it on by clicking on “Admin.” Due to this automatic redirect, the user’s web browser will automatically open a new tab with the address http://localhost/phpmyadmin.

STEP 3 : Next, the user will see multiple tabs such as database, SQL, Status, and User accounts at the top of the window. Now click on “Database” from the menu to access the database. You will notice that there is a button labelled “Create“. Pick a suitable name for the database from the drop down menu in the “Name” box. When it comes to naming your newly created database, it is recommended to provide a name with less than or equal to 64 characters. Names should only contain letters, digits, and underscores. It is not appropriate to start the name of the database with a number. The name should also be relevant to the purpose for which it is created.

STEP 3 : Then, double check to see if the database has been created properly.

STEP 4 : Tables store information in an ordered manner that can be retrieved easily. So, it is crucial to construct tables correctly, as shown below. Now, we will create tables for the database we just created. Navigate to the “Login” page in the database you created and select the “Structure” tab from the drop down menu. The user will notice a button labelled “Create Table” located at the very end of the list of tables. Click on the “Go” button once you have entered the appropriate information into the “Name” and “Number of Columns” columns.

Step 05 : At this point, we need to organize our columns according to the type of data they contain. Then enter names for your columns, select the type of columns, and determine the maximum amount of text that can be entered into each input box. Finally, click the “Save” button in the upper right corner to save your changes. Now, the table is structured with the columns that you initialized. Your database can accommodate any number of tables you choose to add to it.

After reading How to Create a Database on Windows Using XAMPP and MySQL now it is time to check access control to your database.

Keep Access Under Control

You can restrict the number of users who can read and make changes to the data by providing a password for the newly formed database. The default configuration sets the username for the host to “root” and keeps the password empty. Go through the following steps if you want to ensure that your database is more private:

STEP 1: Navigate to the “User Accounts” tab that is located at the very top of the page.

STEP 2: Click “Edit Privileges” located under “Actions,” where “Username” is “root” and “Hostname” is “localhost.” It will enable you to edit permissions for the “root” user.

STEP 3: Type your current password in the space provided after selecting the “Change password” tab. Enter the password once more to ensure it is correct, and click the “Go” button. There is now a password in place.

STEP 4 : Furthermore you can define the privileges given to each user through this

How to Create a Database on Windows Using XAMPP and MySQL Conclusion

By following all the above steps in order, you will be able to successfully create a database on your local Windows computer using XAMPP. Now you can play around with your newly created database by inserting, editing, retrieving, and deleting data to create meaningful information. It will help you see how the data should be arranged systematically. Moreover, you will be able to understand how to use that data to create a well organized computer based database using XAMPP. You may also notice that XAMPP is a very productive yet simple companion for creating local database environments. If you are planning to dive deeper into database management systems, we recommend you start learning a little MySQL and PHP alongside. 

Avatar for Shanika Wickramasinghe
Shanika Wickramasinghe

Senior Software Engineer at WSO2 which is the 6th largest Open Source Software Company in the World. My main skills are machine learning and software development. I have 5+ years of experience as a Software engineer.

1 1 vote
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x