πŸ“‹
Install Nginx, MariaDB, PHP & phpMyAdmin
  • Get Started
  • Install Nginx
  • *Install MariaDB
  • Install MySQL
  • Install PHP
  • Configure Nginx for PHP
  • Test PHP
  • Install phpMyAdmin
  • Update root Password
  • Reference
Powered by GitBook
On this page
  • Configure MariaDB Security
  • Test MariaDB

Was this helpful?

*Install MariaDB

This is option for you to choose either MariaDB or MySQL (Next page)

The next component of the LEMP Stack on Ubuntu 20.04 is MySQL.

Let’s begin by updating the repository and installing the MySQL package using apt.

sudo apt update && sudo apt install mariadb-server

Press Y and ENTER to continue the installation MariaDB package.

Once the package installer has finished, we can check to see if the MariaDB service is running.

sudo service mysql status

If running, you will see a green Active status like below.

● mariadb.service - MariaDB 10.3.30 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor prese>
     Active: active (running) since Tue 2021-08-10 07:08:37 UTC; 38s ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 4370 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 31 (limit: 1072)
     Memory: 66.0M
     CGroup: /system.slice/mariadb.service
             └─4370 /usr/sbin/mysqld

You may to type CTRL+C and hit ENTER or Q to exit the service status.

Configure MariaDB Security

For new MariaDB installations, the next step is to run the included security script. This script changes some of the less secure default options for things like remote root logins and sample users.

sudo mysql_secure_installation

The next prompt asks you whether you’d like to set up a database root password. On Ubuntu, the root account for MariaDB is tied closely to automated system maintenance, so we should not change the configured authentication methods for that account. Doing so would make it possible for a package update to break the database system by removing access to the administrative account.

Press ENTER for none.

OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n]

Press Y and type your new password root.

By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n]

Press Y.

Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n]

Press Y.

By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n]

Press Y.

Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n]

Press Y.

Test MariaDB

sudo systemctl status mariadb

If running, you will see a green Active status like below.

● mariadb.service - MariaDB 10.3.30 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor prese>
     Active: active (running) since Tue 2021-08-10 07:08:37 UTC; 14min ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
   Main PID: 4370 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 31 (limit: 1072)
     Memory: 66.1M
     CGroup: /system.slice/mariadb.service
             └─4370 /usr/sbin/mysqld

You may to type CTRL+C and hit ENTER or Q to exit the service status.

You've completed this section, now your website already integrates with MariaDB.

PreviousInstall NginxNextInstall MySQL

Last updated 1 year ago

Was this helpful?