I installed mysql on an Ubuntu 18.04 server with the Ubuntu Mate Desktop Environment following the instructions in the tutorial "How to install Linux, Nginx, MySQL, PHP on a LEMP server.
In setting up mysql I opted to use the native password for root access and entered the password I had previously set when selecting the level of password validation. I then flushed the privileges and exited. Upon attempting to re-enter mysql I get the following error message:
ERROR 1045 (28000): Access denied for user ‘roor’@‘localhost’ (using password: YES)
I have tried every searched for hours for a solution and have tried many to no avail.
What concerns me is the possibility that I incorrectly entered the ALTER USER command. The instructions tell you to use the following command:
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;
At this point, I assumed root@localhost to be the right thing to enter and I replaced the word password with the password I entered earlier. I also put single quote marks around my password.
Can anyone tell me what I did wrong and what can I do to fix it.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
You could try resetting the root password:
sudo service mysql stopsudo mysqld_safe --skip-grant-tables &mysql -u rootmysql> use mysql;
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD("new_password");
mysql> flush privileges;
mysql> quit
Then stop the (very insecure, wide open) service again (sudo service mysql stop), start it up in normal mode (sudo service mysql start) and try logging on (mysql -u root -p).
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.