This is how I install LAMP server on my Pi's

After a fresh Rasbian installation I do the following:

sudo apt-get update && sudo apt-get install -y apache2 php7.0 libapache2-mod-php7.0 mariadb-server phpmyadmin

Logon credentials for myphpadmin: Username: myphpadmin Password: password entered during installation

If you do not get any privileges, you need to stop the databaseserver, try this:

sudo systemctl stop mariadb

Then you'll need to start it again, but this time, without any privileges:

sudo mysqld_safe --skip-grant-tables --skip-networking &

The ampersamp is for the server to run in the background.