Step 3: Install MariaDB 10 in Ubuntu 16.04
11. Now is time to install MariaDB database with the necessary PHP modules in order to use and access the database from Apache-PHP interface by issuing the below command on your machine console.
$ sudo apt install php7.0-mysql mariadb-server mariadb-client
12. After the installation of MariaDB is complete, run the below security script witch will secure the database (set a root password and answer with yes on all the questions in order to remove anonymous access, disable root login remotely and delete the test database).
$ sudo mysql_secure_installation
13. In order to setup or change MariaDB so that ordinary users can access the database without system sudo privileges, enter to MySQL command line interface with root privileges and issue the below commands:
$ sudo mysql MariaDB> use mysql; MariaDB> update user set plugin=’‘ where User=’root’; MariaDB> flush privileges; MariaDB> exit
Then, restart MySQL service and try to login to database without root privileges by executing the below commands:
$ sudo systemctl restart mysql.service $ mysql -u root -p
Step 4: Install PhpMyAdmin in Ubuntu 16.04
14. Optionally, if you need to manage MySQL database from a web graphical interface (which we don’t recommend on production servers) install Phpmyadmin package by running the below command.
$ sudo apt install php-gettext phpmyadmin
During the installation choose to automatically configure phpmyadmin with apache2 web server, choose No on Configure database for phpmyadmin with dbconfig-common and setup a strong password for the web interface.
15. Finally, after the installation of phpmyadmin package finishes you can access Phpmyadmin web interface by visiting the below URL:
That’s all! Now you have a fully LAMP stack environment installed and running on Ubuntu 16.04, which allows you to create and deploy dynamic websites on your server.