• 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?

6 5 3
7,540 points

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.

9 7 4
38,600 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)


10 6 4
31,120 points

Related questions

0 votes
1 answer 16 views
0 votes
1 answer 60 views
0 votes
1 answer 36 views
Problem: I had installed MySQL on my linux server sometimes back now I forgot the password so I tried to change it using the ways I found online. What I did was as shown below: /etc/init.d/mysql stop mysqld_safe --skip-grant-tables & mysql --user root mysql SELECT * ... it still shows me below errors  "Access denied for user 'root'@'localhost' (using password: Yes)". How to fix above MYSql error?
asked Jul 14 Raphael Pacheco 4.9k points
1 vote
1 answer 345 views
Problem : I am na&iuml;ve to mysql. Currently I am continuously facing below error. &ldquo;Mysql access denied for user 'root'@'localhost' (using password yes)&rdquo;. I have recently started using mySQL Workbench and after doing research on above error I found that my root's ... of no us. I want to get my root access back as soon as possible. Can somebody help me in getting my root access back?
asked Apr 7 morrisBson 3.2k points