Introduction: Creating a Database With XAMPP

XAMPP is a completely free Apache distribution containing MariaDB, PHP, and Perl. XAMPP provides a graphical interface for SQL, allowing you to store information in the database we will create today.

When I first started using databases for projects, I was lost. I needed to Install XAMPP, but couldn't find a guide on doing so. Through a lot of trial and error I got it to work.

From my own experience, the most difficult thing about creating a database through XAMPP is just getting started. Through this instructable I hope that I can help you to quickly and easily install and run XAMPP through to the creation of a database. This will only include the steps up to the inclusion of tables that make up your database and will end once we reach the point of explaining the initialization of the table columns.

Step 1: Downloading XAMPP From Apache

For Mac Users

The first thing you will need to do is go into you preferred browser and go to Apache's Website. From here, you will go to Download and scroll to the Mac section. DO NOT CLICK DOWNLOAD. This was one of my first mistakes when trying to install XAMPP. The downloads on this page are Virtual Machines, which is not what you want. You will want to click More Downloads under the Mac section.

This will bring you to Source forge. You should now see a list of file folders, click on the folder labeled:

  • XAMPP Mac OS X
    • The current version (7.3.4)
      • xampp-osx-7.3.4-0-installer.dmg

Your download will begin. Save and run the dmg file.

For Windows Users

For Windows users the process is similar, but far easier to follow through with. XAMPP has an installer for Windows systems on their website, and all you really need to do is follow a few steps. Select the XAMPP for Windows button on Apache's website, the same one you go to in order to find the Mac version. This will take you to another page where it will immediately prompt you to confirm downloading the Windows version of XAMPP. Simply run the .exe file that is downloaded and follow the steps you are prompted with. Be sure to remember where XAMPP Installs to, this is important for using the application.

Once you have finished installing XAMPP go to the location it has been installed to and find the XAMPP control panel (Titled xampp-control.exe). This file will be located near the bottom of the XAMPP install folder. Right click on this file and select the properties tab. Move to the compatibility tab and check of Run as administrator. This will allow the application to access any file it may need to for full functionality. Once you have done that, the application should be fully functional.

Step 2: Setting Up the Database

For Mac Users

Finding your XAMPP Files

After you run the download, you will have a XAMPP folder in your Mac Applications. Click that folder and you will see a application called manager-osx, the logo is a gear in a bubble, open it.

You will be promoted to enter your Mac's password, don't worry it just needs to run the server.

Starting XAMPP

A XAMPP screen will pop up, click the middle button titled Manage Servers. At the bottom click Start All, wait for the lights next to the servers to turn green, you are ready for the next step!

For Windows Users

Finding your XAMPP Files

All XAMPP files will be located in the same place as your control panel. If you have given this program administrator access (As suggested in the last step) you shouldn't be prompted for any further input beyond maybe confirming that this .exe has administrator access depending on how your preferences are set.

Starting XAMPP

Select the control panel and if necessary confirm administrator access. This will open a panel with several options. The only relevant ones for operating a database are the top two. Those labelled Apache and MySQL. Start those two and you're ready to proceed to the final step (They should be lit up green as in the image).

Step 3: Connecting to PhpMyAdmin

For Mac and Windows

Now that we have our servers running, you can create your database!
Connecting to local host

Getting to your local host is super easy! Open your preferred browser, and type "localhost" in the address bar. Note: (You do not want to type localhost into the google search bar. If you do, you will not allow access to phpMyAdmin). After hitting enter, you are now greeted with the XAMPP welcome page. Congratulations, you successfully installed XAMPP!

phpMyAdmin

In the top right corner of the welcome page you will see a button called phpMyAdmin, click it. This brings you to the phpMyAdmin client. While phpMyAdmin can look overwhelming, I assure you it is easy to navigate.

One the left side of your phpMyAdmin client, you will see a stack of names, these are your databases. Mine may look different than yours, that is okay. Click the "New" button at the top of the stack, this is where you will create your database.

Step 4: Creating Your Database

You will now see an input box near the center of your screen. Decide what you want to name your database, type in the name, and hit create. Note: Do not worry about changing the language from latin1_swedish_ci.

Creating Database Tables

Finally we need to create the tables our data will be stored in. For this, think of a customer in an online store. What attributes does a customer have? To name a few:

  • Name
  • Unique ID(UserID)
  • Address

Each of these would be a column in our table.

Now, name your table and select the number of columns you want to have. In the example, we would enter Customer with 3 columns. After you have chosen the table name and number of columns click Go on the right side of your screen.

Initializing Columns for the Table

We now have to initialize our columns based on their type. Enter the names of your columns, select the type for each, and the max length you want to allow. Click save in the bottom right corner, and your done!

You have successfully created a database with a table and column that is ready for data to be inserted.