Monday, March 30, 2020

Basic MySQL/MariaDB

This post is about setting up MariaDB in Linux. I am using CentOS 7.

1. Install MariaDB

# sudo yum install mariadb-server

2. Enable and start MariaDB

# sudo systemctl enable mariadb
# sudo systemctl start mariadb

3. Use MariaDB

# mysql


For my project, I am preparing a YouTube database, based on a dataseet that I got from Internet. Somehow, this page is no longer available, but I have made a copy of it in my github repository.

At the MariaDB CLI, I created a database called "yt_data" with a DB user that has all privilege to this database.

MariaDB [(none)]> create database yt_data;
MariaDB [(none)]> grant all privileges on yt_data.* to 'db_user'@'localhost' identified by 'db_pass';
MariaDB [(none)]> flush privileges;

In order to login to MariaDB with the user account I created to access to the database that I created, here's the command line.

# mysql -u db_user -p yt_data


Note, by default, MariaDB can be accessed without any credential. You'll need to do necessary configuration/setup for security measurement.

No comments:

Post a Comment