Linux & Bash: Installing MariaDB
In this blog post we will be installing MariaDB, continuing off the previous blog post where we installed HHVM and nginx. MariaDB is a fork of MySQL dedicated to keep MariaDB open. It is fully compatible with MySQL, except for the introduction of extra features.
MariaDB, like HHVM, is available in an external repository.
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository "deb http://sgp1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu $(lsb_release -sc) main"
As mentioned in the previous article, this imports public keys that are used to sign the packages published in the repository, and then adds the repository to the list of repositories for Ubuntu to look up.
sudo apt update
sudo apt install mariadb-server
During the installation, the command will prompt you to set the password for the root
database user. Set one and remember it. DigitalOcean has an article on changing it if you lost access as the root
user.
To secure your MariaDB installation, you should run:
mysql_secure_installation
This ensures that your database is secure. Now you can log in to your database as root! The -p
flag lets MariaDB prompt you for a password.
user@hostname:~$ mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.1.21-MariaDB-1~xenial mariadb.org binary distribution
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Now, you can proceed to installing Wordpress.