• Register
0 votes

Problem :

I am very much new to the whole Mac experience. I have recently installed MySQL on Mac and it is asking me to reset the password after install. It is not allowing me to do anything else.

Now I have already reset the password the usual way as below:

update user set password = password('XXX') where user = root;

Unfortunately again it seems I need to change the password but in some different way that is not known to me. Can someone here has any solution on my problem?

7.5k points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

Please Run below commands:

$ cd /usr/local/mysql/bin
$ ./mysqladmin -u root password 'password'

Then run below commands

./mysql -u root

Now it should log in. Now just run FLUSH privileges;

Then you need to exit the MySQL console and try logging in again. If that doesn't work run these below commands:

$ mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET authentication_string=PASSWORD("XXXXXXX") WHERE User='root';
mysql> quit

Please change xxxxxx to your new password. After that try logging in again.

If you are on the oracle try following command:

ALTER USER username IDENTIFIED BY password

Further Readings :

See this http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

It should give more information on your problem.

38.6k points
0 votes


In case this is NOT your first time setting up the password, attempt this method:

mysql> UPDATE mysql.user SET Password=PASSWORD('your_new_password')
           WHERE User='root'; 

And in case you obtain the pursuing error, there is a high probability that you have never place your password before:

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

To place up your password for the first time:

mysql> SET PASSWORD = PASSWORD('your_new_password');
Query OK, 0 rows affected, 1 warning (0.01 sec)

In case you explained mysql employing mysql -u root -p

Try ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';

First, log in mysql with sandbox mode

mysql -u <user> -p --connect-expired-password

Thereafter, place password

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('XXXX');

Query OK, 0 rows affected, 1 warning (0.01 sec)


31.7k points
edited by