I have just setup a VM instance on Google Cloud and want to run LAMP.The system i use is Ubuntu 18.04 LTS.

When installing MySQL server and PHPmyadmin I dont get a question to set password (usaly do on other setups like DigitalOcean).

I run command: mysql_secure_installation and set a password.

When try login on PHPmyadmin i get:

1698 - Access denied for user 'root'@'localhost'


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

Since i dont use a password when login to putty but a keyfile, i guess no password is set as default?

How would i get remote access to PHPmyadmin?


If you are running MySQL 5.7+, that means for you, that root login is not possible to connect to phpmyadmin.

  1. Connect to MySQL: sudo mysql --user=root mysql

  2. Create user for phpmyadmin: CREATE USER 'phpmyadmin'@'localhost' IDENTIFIED BY 'pass'; GRANT ALL PRIVILEGES ON . TO 'phpmyadmin'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES;


I'm migrating from a traditional, stand alone LAMP box using Ubuntu to GCP, and I had this issue, which drove me insane for a few hours.

Each time I would use mysql -u root -p and provide what I know was the proper credentials, always access denied.

To fix this, I simply had to put SUDO in front of the command, which is a bit counterintuitive to what I was used to. Using sudo is the only way I could finally log in on the command line.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.