1

when accessing my local mysql 5.7 server as a non-root user i get an ERROR 1698 (28000): Access denied for user 'root'@'localhost' message after entering the password

connecting with sudo i can use any (or blank) passwords and always get a mysql prompt.

how do i need to configure mysql to be able to connect as a non root user

*edit: added question

2 Answers2

4

By logging in to MySQL using socket authentication, you can do it.

sudo mysql -u root

Then the following command could be run.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Details are available here.

Huseyin
  • 1,499
  • 2
  • 25
  • 39
1

You can't access MySQL with non-root account, because you haven't created any MySQL user account yet, the default account is root. You'll need to create an user account. Follow this steps or here's the official documentation to create a user account and grant privileges to the new user account.

Ray J
  • 44
  • 3
  • 9