Summary IconKey Takeaways
  • Learn how to create and manage a MySQL database easily using XAMPP, from starting the server to creating tables and importing/exporting data.
  • XAMPP provides a complete local web development environment for testing and development before deployment.
  • The guide covers practical steps like inserting and retrieving data as well as managing databases through phpMyAdmin.
  • Handling large-scale data migrations can be challenging, but automated pipelines simplify the process.
  • Hevo’s no-code platform enables seamless, real-time data integration from MySQL to cloud warehouses or BI tools, reducing manual effort and errors.

The XAMPP stack of software is an open-source, localhost-based server that encompasses software packages offering a multitude of functionalities. You can use the XAMPP control panel to start or deactivate all the software that comes with it.

With XAMPP, you can test projects and modifications before releasing them online. The MySQL database forms a vital component of the XAMPP stack, being one of its most significant features. With XAMPP, you can use phpMyAdmin to create & use your XAMPP MySQL database in minutes.

In this article, we have provided you with a comprehensive explanation of what XAMPP is and how to use it to build a XAMPP MySQL database.

What is XAMPP?

XAMPP is an open-source web server solution stack package developed by Apache Friends. It consists of the Apache HTTP Server, MySQL database, and interpreters for PHP and Perl programming languages.

XAMPP makes it easy to set up a local web server for testing purposes on your own computer, allowing web developers to quickly test their applications during development.

You can download XAMPP using this link.

What is MySQL?

MySQL is an open-source relational database management system based on SQL, which is free and popular for web applications.

MySQL is used by many database-driven web applications, including WordPress, Facebook, Twitter, YouTube, and Google, to provide fast and reliable storage and retrieval of website and app data, such as user profiles, content, statistics, etc.

How to Use XAMPP to Create a MySQL Database?

Here’s how to use XAMPP for MySQL:

Step 1: Opening XAMPP

  • In this section, we will show you how to open MySQL in XAMPP. Go to your system’s XAMPP folder or simply click the XAMPP Icon to open it. The control panel is now visible, and you may use it to start or stop any module.

Step 2: Starting XAMPP

  • Select the “Start” option for the Apache and MySQL modules, respectively. The user will see the following screen once it has started working:

Step 3: Accessing Admin

  • Next, select the MySQL module and click the “Admin” button. The user is immediately redirected to the following address in a web browser:
http://localhost/phpmyadmin

Step 4: Creating a Database

  • Next, we will learn how to create a database in XAMPP. Setting up an XAMPP database is straightforward, making it convenient for beginners to practice database management. A number of tabs appear, including Database, SQL, User Accounts, Export, Import, Settings, and so on. Select the “Database” tab from the drop-down menu. The “Create” option is visible there. Choose a suitable name for the Database input field.

Step 5: Creating a Table

  • Let’s construct a table named entries.  There are various options for creating a table.
  • You can utilize the “Create Table feature.
    • On the phpMyAdmin screen, choose the guestbook database.
    • Select the “Structure” tab.
    • Under “Create Table”, provide a table name and the number of columns.
    • Click the “Go” button. This prompts you to input the column information.
    XAMPP MySQL

    You may use the SQL command to create a table.

    • On the phpMyAdmin screen, choose the “SQL” tab.
    • Enter the following code.
    USE guestbook; 
    CREATE TABLE entries (guestName VARCHAR(255), content VARCHAR(255), 
        entryID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(entryID));
    XAMPP MySQL

    If you have already selected the guestbook database (on the left panel), you do not need to include “USE guestbook” in your SQL query.

    To run the command, simply click the “Go” button.

    Note: You can use the following shortcuts on your keyboard to run commands

    • Mac users may hit Control+Enter to run.
    • For Windows users, press Control+Enter to run.

    Step 6: Insert Data

    • There are various options for inserting data into a table.
    • You may utilize the “Insert” feature
      • On the phpMyAdmin screen, pick the “guestbook database” and then the entries table.
      • Select the “Insert” tab.
      • Enter the value for each column for each data record that will be added.
      • Click the “Go” button.
      XAMPP MySQL

      You can use the SQL command to insert data.

      • On the phpMyAdmin screen, pick the “guestbook” database and then the entries table.
      • Select the SQL tab.
      • Enter the following code.
      INSERT INTO entries (guestName, content) values ("Humpty", "Humpty's here!");
      INSERT INTO entries (guestName, content) values ("Dumpty", "Dumpty's here too!");
      XAMPP MySQL

      To run the command, simply click the Go button.

        Understand how Data Loading takes place in MySQL with our comprehensive guide. 

        Step 7: Retrieve Data

        • There are various ways for retrieving data from a table.
        • You may utilize the “Browse” option.
          • On the phpMyAdmin screen, select the “guestbook” database and then the entriestable.
          • Select the “Browse” tab. This will display all existing records in the table.
          XAMPP MySQL

          You may use the SQL command to get data.

          • On the phpMyAdmin screen, pick the “guestbook” database and then the “entries” table.
          • Select the “SQL” tab.
          • Enter the following code.
          SELECT * FROM entries;

          To run the command, simply click the “Go” button.

          Note: Run mysqlcheck to verify and repair tables before retrieving data.

            Step 8: Importing SQL File

            • Create a blank file calledfriendbook.sql”. Paste the following text into the file.
            CREATE TABLE friends
               (friendName VARCHAR(255),
                phone VARCHAR(255),
                entryID INT NOT NULL AUTO_INCREMENT,
                PRIMARY KEY(entryID));
            
            INSERT INTO friends (friendName, phone) values ("Humpty", "111-111-1111");
            INSERT INTO friends (friendName, phone) values ("Dumpty", "222-222-2222"); 
            • On the phpMyAdmin screen, choose the “guestbook” database.
            • Select the “Import” tab.
            • Choose the .sql file to import.
            XAMPP MySQL

            To run the command, simply click the “Go” button.

            Set up MySQL replication to synchronize your imported databases across environments.

              Step 9: Export SQL File

              XAMPP MySQL
              • On the phpMyAdmin screen, choose the “guestbook” database.
              • Select the “export” tab.
              • Click the “Go” button to run the command.
              • To run the command, simply click the “Go” button.
              • Alternatively, you can use mysqldump to export your XAMPP MySQL databases efficiently.

              XAMPP MySQL – Saving the Database

              We must now initialize the columns according to their kind. Fill in the names for each of your columns, as well as the type and the input field’s maximum length. In the bottom-right corner, click “Save.” The table has been constructed with the initialized columns. Your Database can have as many tables as you like.

              XAMPP MySQL – Use Cases

              • Developing and testing web applications: XAMPP provides a local development environment that includes an Apache web server, a MySQL database server, and interpreters for PHP and Perl. This allows developers to create and test web applications on their local machines without needing to deploy them to a remote server.
              • Content management systems (CMS): Many popular content management systems (CMS), such as WordPress, Joomla, and Drupal, use MySQL databases to store their content. XAMPP can be used to develop and test these CMS locally before deploying them to a live server.
              • E-commerce applications: Utilize MySQL databases to store product information, customer data, and order details. XAMPP can be used to develop and test these applications locally before deploying them to a production environment.
              Replicate Data from MySQL to MS SQL Server
              Replicate Data from MySQL to Snowflake
              Replicate Data from PostgreSQL to MySQL

              Conclusion

              In this guide, we’ve shown you how MySQL plays a crucial role in web development and why XAMPP MySQL can act as the backbone of any successful project. With the need for thorough testing and a secure, fully equipped environment, XAMPP provides everything developers need to build, test, and run their applications smoothly.

              Managing the growth of databases and the increasing number of linked procedures, such as business analytics, is a challenging task. Migrating large volumes of data from MySQL to a cloud-based data warehouse is a time-consuming and inefficient operation. Still, with a data integration tool such as Hevo you can do it in no time and with no code.

              Sign up for a 14-day free trial and simplify your data integration process. Check out the pricing details to understand which plan fulfills all your business needs.

              Share your experience of how to use XAMPP MySQL Database in the comments section below!

              FAQs

              1. How to Use MySQL on XAMPP?

              Start MySQL from the XAMPP Control Panel by clicking the “Start” button next to MySQL. Access the MySQL database management interface via the “Admin” button, which opens phpMyAdmin for easy database administration. You can also connect to MySQL from your applications using default credentials or via command line tools.

              2. Do I Need MySQL if I Have XAMPP?

              Yes, MySQL is included as a core component of XAMPP and is necessary for any database-driven web applications you want to develop or test locally. XAMPP’s easy packaging means you get MySQL ready to use without separate installation.

              3. Why Is XAMPP Used for MySQL?

              XAMPP provides a pre-configured, easy-to-use local server environment that simplifies testing and development of MySQL databases alongside web servers (Apache) and scripting languages (PHP, Perl). This makes it popular for developers building database-backed applications.

              4. Is MySQL automatically installed with XAMPP?

              Yes, MySQL is bundled with XAMPP and installed automatically when you install XAMPP. This removes the need to separately install or configure the database server.

              5. How do I know if MySQL is running in XAMPP?

              Open the XAMPP Control Panel and check the MySQL row. When you click “Start,” the MySQL module background changes to green indicating it is running successfully and ready to serve your database requests.

              Davor DSouza
              Research Analyst, Hevo Data

              Davor DSouza is a data analyst with a passion for using data to solve real-world problems. His experience with data integration and infrastructure, combined with his Master's in Machine Learning, equips him to bridge the gap between theory and practical application. He enjoys diving deep into data and emerging with clear and actionable insights.