Files
J1B4-Fitbot/docs/documentation/raspberry-pi/mariaDB/mariaDB.md
2024-05-15 12:04:36 +02:00

1.8 KiB

MariaDB create database

In this guide, we will show you how to create a new database in MariaDB. This will allow you to store and manage data in a structured way.

Prerequisites

Before you begin, you will need the following:

  • A Raspberry Pi with Raspbian installed
  • Access to the terminal on your Raspberry Pi
  • MariaDB installed on your Raspberry Pi

If you have not already installed MariaDB, you can follow our guide on how to install MariaDB on your Raspberry Pi.

Step 1: Access the MariaDB Shell

The first step is to access the MariaDB shell. You can do this by running the following command in the terminal:


sudo mysql -u root -p

You will be prompted to enter the root password that you set during the MariaDB installation process.

Step 2: Create a New Database

Once you are in the MariaDB shell, you can create a new database by running the following command:


CREATE DATABASE database_name;

Replace database_name with the name that you want to give to your new database.

For example, to create a database called mydatabase, you would run the following command:


CREATE DATABASE mydatabase;

Step 3: Verify the Database Creation

To verify that the database has been created successfully, you can run the following command in the MariaDB shell:


SHOW DATABASES;

This will display a list of all the databases on your MariaDB server, including the one that you just created.

Conclusion

You have successfully created a new database in MariaDB. You can now start adding tables and data to your database to store and manage information. If you have any questions or run into any issues, feel free to refer to the MariaDB documentation for more information.