I just set up a new droplet. After configuring mysql for root and any other user with passwords, I just can´t seem to be able to access it correctly. 1. the root user logs in even without the password (unfortunately not usable in my PhP scripts). 2. On the other user (e.g. userX, the password does not allow me to log into the mysql even when I have used the correct one and I have rechecked a number of times. What could be the problem?
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!
Hi @MabeleL,
The root user for your MySQL most probably has a .my.cnf file which it uses to login without having to use the password.
Regarding the other user, have you given the user any permission to access a database? The best way to check is no use it in a PHP script but in the CLI directly. Basically, SSH to your Droplet and type in
- mysql -u UserHere -p DatabaseHere
or if you just need to connect to MySQL:
- mysql -u UserHere -p
Where UserHere is your actual DB user and DatabaseHere is your actual DB.
The above commands will prompt you for your password after which has been provided you should log in MYSQL. What you can do then is type
show databases;
to see the database that you have access to with the said user.
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.