3

Mac 10.10.1, Mysql 5.6.22

When I install mysql in my mac,and I write mysql -u root -p on the Terminal,it occur the error:

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

When I use Sequel PrO to connect the mysql,it occur the same error.

I try many method in stackoverflow,suck reset mysql password,and so on,it doesn't work

Any solution for this?

Raptor
  • 53,206
  • 45
  • 230
  • 366
chao zhou
  • 73
  • 1
  • 2
  • 10
  • *Wrong password* . Isn't it clear enough? – Raptor Jan 22 '15 at 02:29
  • I try to reset password,and I think I have already reseted the password. – chao zhou Jan 22 '15 at 02:42
  • Did you reload the privileges & restart the MySQL ? – Raptor Jan 22 '15 at 02:44
  • It's either a bad password, root@localhost is not added to database, or root@localhost does not have sufficient privileges in the database. – EternalHour Jan 22 '15 at 02:45
  • http://stackoverflow.com/questions/4359131/brew-install-mysql-on-mac-os/6378429#6378429 It works for me with this method in the link – chao zhou Jan 22 '15 at 03:10
  • 1
    @chao zhou since your problem seems solved, please, consider upvoting the answer which helped you, and adding here a short answer to this question, with the few steps which helped you. (you **can** answer to your own questions) Linking to a thread of several pages doesn't help much – Balmipour Sep 10 '15 at 12:06
  • maybe root doesn't have a password? tried `mysql -u root` ? – Ameer Sheikh Jan 19 '17 at 09:46
  • See at [here](https://askubuntu.com/a/777008) – tnductam Mar 07 '19 at 16:36
  • Tried to answer the same question in a different thread. Check it out if that might help https://stackoverflow.com/a/67597173/6840615 – Md Sifatul Islam May 19 '21 at 04:59

2 Answers2

1

Reset your password: -

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

Then you can connect with actual credential.

puneet gupta
  • 373
  • 3
  • 7
1

MacOS Sierra blocks the sites that use system proxy settings, where all connections of localhost 127.0.0.1 are blocked. As a result, MySQL server does not work. To fix this problem, follow the instructions below.

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

if you are using Netbeans with it you should also do the following

  1. Launch NetBeans IDE.
  2. Select Preferences... form the NetBeans menu. 11. Click the General tab to select it .
  3. Select Use System Proxy Settings.
  4. Click Reload.
  5. Click Test connection.
  6. You must get the green checkmark, , indicating that the connection is successful.
  7. If the connection is successful, you can Clean & Build your applications in NetBeans IDE and Run them.
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103