Hi,
For some reason, I’m unable to access SQL on my host:
mysql -u root -p
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
The password is correct I believe, and I’m logged into ‘root’ rather than my regular login.
Hope you can help
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!
The root password for SSH and the root password for MySQL will/should be different, so just because you’re logged in as root via SSH doesn’t mean you’ll be able to login as root to MySQL.
If you installed MySQL from the CLI using a command such as:
apt-get install -y mysql-server
or
apt-get install -y mariadb-server
The root password for MySQL is set one of two ways.
mysql_secure_installation and set the password when prompted.That doesn’t work either. When installing mysql-server, it doesn’t prompt to set a password, and when running mysql_secure_installation it asks for a password, which throws the same error:
#mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root: Error: Access denied for user ‘root’@‘localhost’ (using password: YES)
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.