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
![](https://linuxmining.com/wp-content/uploads/2020/10/mariadb-install-1024x224.png)
Now start & enable mariadb server :
systemctl start mariadb
systemctl enable mariadb
![](https://linuxmining.com/wp-content/uploads/2020/10/mariadb-start-1024x65.png)
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.
![](https://linuxmining.com/wp-content/uploads/2020/10/mysql-secure.png)
![](https://linuxmining.com/wp-content/uploads/2020/10/mariadb-secure1.png)
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
![](https://linuxmining.com/wp-content/uploads/2020/10/mariadb-create-db.png)
Now restart mariadb server :
systemctl restart mariadb
Thank you for reading this article.
Was this helpful?
1 / 0