We have seen many changes and improvement on Linux in the past years, and I have to admit, my initial tutorial on how to install a LAMP server (Linux Apache Mysql PHP) is now outdated if you use Debian 9 or Ubuntu 16.10.
Indeed, PHP5 has been replaced by PHP7 in most of the recent distributions (Debian 9 and Ubuntu 16.10 for instance) and following the acquisition of Mysql from Oracle, and the fork that followed (Mariadb), most of the distributions are not using mariadb as well.
This basically means to you will not be able to install LAMP by using old tutorials.
I am myself, discovering those ameliorations, but here is a new tutorial to install LAMP on Ubuntu or Debian.
1) Install Apache, MariaDB, PHP
Run the following command with sudo or as root:
apt-get install apache2 mariadb-server php-mysql
2) Add a password to the user ROOT of MariaDB
It seems, unlike mysql, MariaDB is not asking to setup a root password when you install it. This means it is a step faster to run development apps, but you will need to set it up manually. Simply run:
mysqladmin -u root password 'enter password here'
and restart the service
service mysql restart
3) Install PHPMyAdmin
You probably wants to install PHPMyAdmin to simplify the management of your databases (Can be easily done with the web interface). The installation is simple, still in root or with sudo run:
apt-get install phpmyadmin
however, MySQL 5.7 (and thus MariaDB) changed their model for security. Now to connect to MySQL root, you will need sudo or to be logged in as root on your machine. This also means that phpMyAdmin will not be able to use root as a user.
You will need to create a dedicated user to do so. Here is how:
mysql -u root CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; exit
Replace newuser with the user you want and password with the password you want.
The restart the service.
service mysql restart
Now you should have access to Phpmyadmin at http://yourserver/phpmyadmin and use the newly created user/password combo to use PhpMyAdmin.