Saturday, May 2, 2020

Installing mariadb-server on Ubuntu using sudo


This article demonstrate steps to install MariaDB/MySQL on Ubuntu using sudo. This is part of our getting started journey to learn MariaDB/MySQL. I will be covering PostgreSQL in another article.

Before we get started, very first step would be to install MariaDB/MySQL Server and client. You can install any of these RDBMS on Windows but this blog will mostly be following Ubuntu OS.

There are various tools to access MariaDB/MySQL Server, we are going to use mysqlclient and Heidisql.

Lets get started with installation of MariaDB.

Step 1: Open your Ubuntu terminal window or bash and run following cmd. This step is going to check if mariadb-server is already installed and is going to remove it. You can either continue using the current setup or go to next step to do a fresh installation
sudo apt-get remove mariadb-server

Step 2: run
sudo apt-get install software-properties-common

Step 3: Check for Ubuntu updates
sudo apt-get updates

Step 4: Install Ubuntu updates
sudo apt-get upgrade

Step 5: Install mariadb-server and client. If you just want to install mariadb-server or mariadb-client, just remove the other from the cli.
sudo apt-get install mariadb-server mariadb-client

Step 6: Start/Stop/Restart mariadb-server
service mysql start/stop/restart

Step 6: Connect to mariadb-server using client, run below and enter your password to connect.
mysql -u root -h localhost -p

No comments:

Post a Comment