How to Create Database of MariaDB in XAMPP

GOAL

Today’s goal is create database with MariaDB.

Environment

Windows10
XAMPP 7.4.10

If you don’t have XAMPP, please install it first according to “Installation of XAMPP“. And If you’ll use MariaDB in a production environment, make it secure by setting password according to “How To Set MySQL Password in XAMPP“.

Method

1. Open phpMyAdmin

Start XAMPP Control Panel and run Apache and MariaDB.

Access localhost/phpmyadmin/ or click Admin button of MySQL.

2. Create new database

Now I’ll create database of photo sharing service like this. I create only user database today.

Click “Database” on phpMyAdmin.

Input the name of the database and click “Generate”. I named it “photo_sharing”.

The database “photo_sharing” is added to the list of database and the page moved to “Structure”.

3. Create table in generated database.

Create a table for “User” object with 3 columns, ID, Name, Age. Input Name, set Number of columns and click “Go” button.

Change the name of each column and set data type, Length or another parameters.

* The TEXT type is different from VARCHAR type. In brief, VARCHAR is the data type to store sentence of limited length and TEXT is the one to store sentence of unlimited length. See the “VARCHAR” and “TEXT” of MariaDB Knowledge Base.

Use auto-increment for ID column.

And save the table. The new table is created.

4. Insert new data

Select user table and open “Insert” tab.

Input name and age of each user. You don’t need to input id because it is set automatically. And click “Go” button.

The SQL is generated. And you can see the added data in “Browser” tab.

Next?

Access MySQL with PHP in XAMPP