Install mariadb or mysql on centos or ubuntu

If you want to install mariadb or mysql on ubuntu server then use apt-get instead of yum.

First update your current packages with this command on cli mode :

yum update -y

for ubuntu : apt-get update -y && apt-get upgrade -y

Now install the open source sql server that is mariadb server :

yum install mariadb-server mariadb-client -y

Now start & enable mariadb server :

systemctl start mariadb
systemctl enable mariadb

Now secure your mariadb (most of the cases all commands are same).
run below command :

mysql_secure_installation

first enter blank then set root password then enter yes for every step.

Now mariadb is ready to run.

Now Create a mariadb database & user :

mysql -u root -p
create database testdb;
create user ‘testuser’@’localhost’ identified by ‘password’;
grant all on testdb.* to ‘testuser’ identified by ‘password’; flush privileges;
exit

Now restart mariadb server :

systemctl restart mariadb

Thank you for reading this article.

Was this helpful?

1 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *