To install and setup MariaDB on Ubuntu and run on any of the cloud platforms (Azure, AWS or Google GCP), the best way is to use the readily available images in the marketplaces. Deploy with the latest version of MariaDB on Ubuntu. Check the links below to deploy straight into your environment.
Once connected and logged in, the following section explains how to start using MariaDB.
Using MariaDB on Ubuntu
To improve the security of MariaDB and change the root user password, remove the anonymous user, restrict root user access to the local machine. Run the following command:
sudo mysql_secure_installation
MariaDB root login details are:
User: root
Pass: blank (no password set)
Next is to open the MySQL client shell with the following command:
sudo mysql
Create MariaDB Database
Once your on the MySQL client shell, the following example code snippets will create a test database called mariadbcloud:
CREATE DATABASE mariadbcloud;
To show a list of your created databases, run the following command:
show databases;
Create New MariaDB User
To create a new user in MariaDB, We type the following command. Simply replace mariadbuser with the name of the user you would like to create and replace the password123 with your chosen password.
CREATE USER 'mariadbuser'@localhost IDENTIFIED BY 'password123';
Once you’ve created your new user, to check the status of the user, simply run the following command:
SELECT User FROM mysql.user;
Grant Privileges to MariaDB User
Your newly created user does not have privileges to manage any MariaDB databases or to access the MariaDB shell. So to grant all privileges to our new user, we run the following command:
GRANT ALL PRIVILEGES ON *.* TO 'mariadbuser'@localhost IDENTIFIED BY 'password123';
The *.* in the statement refers to the database or table for which the user is given privileges. This specific command provides access to all databases located on the server. As this might be a major security issue, you should replace the symbol with the name of the database you are providing access to. So in our database we would run the following command to only give permissions on our database.
GRANT ALL PRIVILEGES ON 'mariadbcloud'.* TO 'mariadbuser'@localhost;
Then we need to refresh the privileges so it updates with the following command:
FLUSH PRIVILEGES;
Documentation on using MariaDB can be found on the following link:
If you require any help with the installation of MariaDB, leave a comment below or contact us directly if you are experiencing any issues.
Disclaimer: MariaDB® is a registered trademark owned by MariaDB Corporation Ab, Inc and is licensed under GPL v2 license. No warrantee of any kind, express or implied, is included with this software. Use at your risk, responsibility for damages (if any) to anyone resulting from the use of this software rest entirely with the user. The author is not responsible for any damage that its use could cause.
Cloud Solution Architect. Helping customers transform their business to the cloud. 20 years experience working in complex infrastructure environments and a Microsoft Certified Solutions Expert on everything Cloud.
00votes
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.