0

I have been trying to reset the root password for MySQL on my Mac OS X Sierra and I cannot believe I can't find documentation for this anywhere that can resolve my problem.

The first error I got when I tried to access my database is this:

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

I figured I would completely remove MySQL and install it again with brew but when I tried with mysql_secure_installation and I get this:

Securing the MySQL server deployment.

Enter password for user root:
Error: Access denied for user 'root'@'localhost' (using password: NO)

Also when I try to run:

mysql.server stop

I get this error:

 ERROR! MySQL server PID file could not be found!
halfer
  • 19,824
  • 17
  • 99
  • 186
Daniel
  • 14,004
  • 16
  • 96
  • 156

2 Answers2

0

On mac, I think you have to use root as a password.

math2001
  • 4,167
  • 24
  • 35
  • when i try root as a password I get this error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) – Daniel Jan 16 '17 at 01:18
0
  1. open mysqld_safe

    mysql.server stop

    mysqld_safe --skip-grant-tables

  2. open a new terminal

    mysql -uroot -p

    use mysql;

    update user set password=PASSWORD('123456') where user="root";

    flush privileges;

    quit;

  3. close mysqld_safe terminal

  4. restart mysql

    mysql.server start

    mysql -uroot -p

    123456

imdba
  • 1