I have been trying to reset my MySQL root password. I have run the mysqld_safe --skip-grant-tables, updated the root password, and checked the user table to make sure it is
have a look at this from MySQL Reference manual:
First login mysql:
# mysql -u root -p
Then at mysql prompt run:
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
Then
FLUSH PRIVILEGES;
Look at this page for more information: Resetting the Root Password: Unix Systems
a common error i run into from time to time, is that i forget the -p
option, so are you sure you used:
mysql -u root -p
Tried the answer from @kta but didn't work for me.
I am using MySQL 8.0
This worked for me:
mysql> SET PASSWORD FOR 'root'@'localhost' = 'yourpassword'
Or just use interactive configuration:
sudo mysql_secure_installation
You have to reset the password! steps for mac osx(tested and working) and ubuntu
Stop MySQL
$ sudo /usr/local/mysql/support-files/mysql.server stop
Start it in safe mode:
$ sudo mysqld_safe --skip-grant-tables
(above line is the whole command)
This will be an ongoing command until the process is finished so open another shell/terminal window, log in without a password:
$ mysql -u root
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
Start MySQL
sudo /usr/local/mysql/support-files/mysql.server start
your new password is 'password'.