How to Install LAMP Stack with PhpMyAdmin in Ubuntu 18.04

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

15 Responses

  1. Cathal says:

    This worked flawlessly, first time, for running LAMP locally. Thank you.

  2. Randy R says:

    Very helpful and simple !! Thank you very much !!

  3. Michael says:


    New to LAMP and phpmyadmin, everything was going pretty smoothly until I tried to login to phpmyadmin. This is what is on the screen I input user and password.

    #1698-Access denied for user "root"@"localhost
    musqli_real_connect(): (HY000/1698): Access
    denied for user "root"@"localhost'

    If anyone could help I would greatly appreciate it

    • Aaron Kili says:


      You encountered this error because MySQL is not allowing remote users to log in as root for security reasons. Add a new database user and login with that user’s credentials.

      $ sudo mysql -p -u root
      $ CREATE USER 'username'@'%' IDENTIFIED BY 'user's_password_here';
      $ EXIT

      Then login as the just created user.

  4. Oliver Russell says:

    This manual process of setting up LAMP and then configuring PHPMyAdmin seems really long and tiring. I have never really done that manually since I am using Cloudways platform for hosting PHP website, which has it installed and configured automatically on the server.

  5. jeffschips says:

    had to do apt-get install libapache2-mod-php5 or I only saw code in phpmyadmin

  6. Chibuike Kenneth says:

    Tried many installation so far, this is the best….

    Thank you for this

  7. Cesar says:

    can;t connect using phpmyadmin

    mysqli_real_connect(): (HY000/1698): Access denied for user ‘root’@’localhost’

  8. Martin says:

    Hello, a hint to your article:

    “A LAMP stack is composed of packages such as Apache, MySQL/MariaDB and PHP installed on a Linux system environment for hosting websites and apps”, which did help me a lot – with one command missing in Step 3:

    $ sudo apt install libapache2-mod-php.

    Best Regards

  9. María Ramírez says:

    Excellent! Thanks so much, it was very useful! :D

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.