Home > Software engineering >  ERROR 1045 (28000): Access denied mysql 5.7 macos
ERROR 1045 (28000): Access denied mysql 5.7 macos

Time:07-26

I've been trying to reset my password in Mysql for five hours now. When I write:

mysql -u root -p

I get

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I should also add that my MySql server is running according to system preferences.

When I try the solutions on mentioned here

which says to try

/usr/local/opt/mysql/bin/mysqladmin -u root password 'new-password'

I can't do that because there is no such path on my computer. And in the folder /usr/local/mysql/bin/ there is no file called mysqladmin

That site also recommends

Select System Preferences... from the Apple  menu and click the Network app to launch it as shown below.
Click your Wi­Fi connection to select it
Click the Advanced... option
Click the Proxies tab to select it
Check the top 3 options Auto Proxy Discovery Automatic Proxy Configuration Web Proxy (HTTP)
Click OK.
Click Apply.
Quit System Preferences.

But that does not work either.

CodePudding user response:

for reset password for mysql user root as follows:

UPDATE mysql.user SET authentication_string=PASSWORD('password')  WHERE  User='root';

CodePudding user response:

By watching this video I was able to solve the problem.

I stopped the mysql server then input

sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

I then got this output

2022-07-26T06:19:17.6NZ mysqld_safe Logging to '/usr/local/mysql/data/Admins-MacBook-Pro-4.local.err'.
2022-07-26T06:19:17.6NZ mysqld_safe Logging to '/usr/local/mysql/data/Admins-MacBook-Pro-4.local.err'.
2022-07-26T06:19:17.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

which also turned the mysql server back on. That's all it took.

  • Related