MariaDB is a popular open-source database management system that is widely used as a drop-in replacement for MySQL. In this guide, we will walk you through the steps to install and use MariaDB on Ubuntu 22.04. Whether you are deploying it on a local server or using a Windows VPS UK, this tutorial covers all the necessary steps.

Step 1: Update Your System

Before installing MariaDB, ensure your system is up to date. Run the following commands:

sudo apt update && sudo apt upgrade -y

Keeping your system updated is crucial for security and performance, whether you're setting it up locally or on a VPS Windows Servers platform.

Step 2: Install MariaDB

You can install MariaDB using the following command:

sudo apt install mariadb-server -y

This command will download and install MariaDB along with its dependencies.

Step 3: Secure MariaDB Installation

After installing MariaDB, it's important to secure the installation. Run the following command:

sudo mysql_secure_installation

Follow the prompts to set a root password, remove anonymous users, disallow root login remotely, and remove the test database.

Step 4: Start MariaDB Service

Start the MariaDB service and enable it to run on boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 5: Log into MariaDB

To access the MariaDB command-line interface, run:

sudo mysql -u root -p

Enter the root password you set during the secure installation process.

Step 6: Create a Database

To create a new database, use the following command within the MariaDB CLI:

CREATE DATABASE my_database;

Replace my_database with the name of your database.

Step 7: Create a User

You can create a new user and grant them access to your database with the following commands:


CREATE USER 'my_user'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON my_database.* TO 'my_user'@'localhost';
FLUSH PRIVILEGES;
            

Replace my_user and my_password with your desired username and password.

Step 8: Show Databases

To list all databases, use the following command:

SHOW DATABASES;

Step 9: Use a Database

To select a database to use, run:

USE my_database;

Step 10: Exit MariaDB

To exit the MariaDB command-line interface, type:

EXIT;

You have successfully installed and configured MariaDB on your Ubuntu 22.04 server, enabling you to manage your databases effectively. For reliable and scalable hosting solutions, consider using Windows VPS UK. They offer a variety of hosting options, including windows virtual private servers, windows vps hosting, and windows virtual dedicated server hosting. Whether you're looking for windows vps italy or uk vps windows solutions, their hosting services provide the performance and flexibility needed to support your database management tasks.

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)