简体   繁体   中英

MySQL: Access denied for user 'root'@'localhost' (using password: YES)

I'm trying to install and run MySQL 8.0.22 on Mac (Mojave) and have been unable to do so.

I am trying to use the command

$ sudo /usr/local/mysql/bin/mysql -u root -p

and am prompted to enter the root password, which I do but am then met with the error:

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

I am 100% sure that I am entering the correct password I created during installation (and I have reinstalled multiple times now), so I don't understand what the problem is.

I have looked at other posts online about how to fix this, but none work.

Does anyone have any insight into this problem with a fresh install? Thanks!

Few things to check.

  • Check any.my.cnf files are present in the current directory which overrides the password.
  • Login with the command mysql -uroot -p -h<<ipaddress>>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM