MySQL access denied for new user accounts

Hey everyone, I’m new to MySQL and could use some help. I set up MySQL 8.4 on my Windows machine and created a root password. Then I made two new users, let’s call them user1 and user2, with their own passwords.

When I use PowerShell to log in as root (mysql -u root -p), it works fine. I type the password and can run commands. But when I try to log in with one of the new users (mysql -u user1 -p), it asks for the password but then denies access.

I’m pretty sure I’m missing something obvious, but I can’t figure it out. Any ideas why this is happening? Thanks for any tips!

have u checked the privileges for those new users? sometimes mysql can be picky about permissions. try running ‘SHOW GRANTS FOR user1@localhost;’ as root to see what access they actually have. might need to grant more privileges or fix the host part if its not set right

It sounds like you might have an issue with the authentication plugin or host specification for your new users. By default, MySQL 8 uses caching_sha2_password for authentication, which can cause problems if your client doesn’t support it. Try creating the users with mysql_native_password instead:

CREATE USER ‘user1’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘password’;

Also, make sure you’ve specified the correct host when creating the users. If you used ‘%’ instead of ‘localhost’, you might need to adjust your connection string. Lastly, don’t forget to FLUSH PRIVILEGES after making changes. If none of this works, check the MySQL error log for more detailed information about the access denial.