Mysql user access denied message for a new ubuntu user
I followed linode ubuntu setup guide, I have now 2 users root and 2nduser with sudo. So I created a new mysql user also, lets call it mysqluser
But if I type sudo mysql -u root, then it gives me access.
Also, when logged in as root in the terminal i.e [email protected] , then mysql -u mysqluser -p works.
I can connect my PHP to mysql using the same mysql user but it gives me error in terminal.
Any help would be appreaciated.
You may need to change to a root shell using
sudo su - before entering your credentials with
mysql -u mysqluser -p. This StackOverflow post has a helpful overview, but essentially newer versions of MySQL require the use of a root shell. Since you mentioned that when you're logged in as root, you can log in as
mysqluser without difficulty, this is likely the case with the issue you're seeing as well. You'll need to flush privileges and restart MySQL if you make the recommended changes from the linked resource.