Many have begun to call MariaDB their go-to relational database management system. It started as a fork of MySQL in 2009. Since then, many features have been added – making it a necessity for companies like Google. These include better performance, new extensions, and – unlike MySQL – every component is open source.
Make Sure Ubuntu Is Up to Date
The first step is to update your server repositories. This ensures that the packages you receive are current, with patches for performance or security problems. Enter the following command and then your password when prompted.
apt-get update && apt-get upgrade -y
Install the MariaDB server package
Now that we’re sure the most recent version is available, let’s install it. Only one package is required: mariadb-server. Use apt-get to initiate the process.
apt-get install mariadb-server -y
The terminal will request your password and ask for permission to install dependencies. After this, MariaDB will prompt you for the password for the ‘root’ database administrator. Choose something strong, and wait for the process to complete.
Secure Your Database Server
It’s not enough to have a strong password. Several easy changes should be made to ward off hackers. If you have used MySQL, then mysql_secure_installation may seem familiar. This tool guides you through steps to increase your database’s security. Run the command
Then, consider making the following decisions:
• Keep the root password that was set earlier.
• Remove anonymous users.
• Disallow remote logins.
• Remove the test database.
• Reload privilege tables.
Test Your Installation
Provided everything installed properly, you can log in using the commands below. Since MariaDB is a fork of MySQL, there are similarities.
mysql -u root -p
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 42
Server version: 5.5.49-MariaDB-1ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
If you are greeted with a welcome message, your work is done.
You now have a fully-functioning and secure MariaDB server. Much of the front-end interaction will be the same as what is found in MySQL. It’s even possible to directly swap data from an existing MySQL database without problems; that’s the power of open source.
If found this guide helpful, please be sure to share it with friends. You can also take a look at our other guides where we cover topics such as networking, databases, and server applications.