Question

creating a mysql dedicated user to either manage database locally or remotely on ubuntu 20.04

I have been following this (tutorialhttps://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04) keenly and doesn’t even allow me even create a user who can manage database locally. I’m getting an error acess denied for ‘newusername@localhost’ (using password: YES)


Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @samunyi90,

First, you need to create the user and give him privileges to use/manage the databases you want. In the tutorial this can be found at STEP 3 - Creating a Dedicated MySQL User and Granting Privileges.

Now, if you’ve done that, you need to allow access from outside to your MySQL, the best way is to allow only your IP address.

Next, think you need to check is, if the password you used is correct. More often than not, this is the issue.

Next thing, I’ve seen happen is

mysql -u DBuser -p mypass

Whitespace IS apparently allowed between the -u #uname# but NOT between the -p and #password#

Therefore needed:

mysql -u DBuser -pmypass

Otherwise with white-space between -p mypass mysql takes ‘mypass’ as the db name OR you can use the following command

mysql -u DBuser -p DBname -h XXX.XXX.XXX.XXX

Additionally, can you post the command you used to create the user?