The MySQL root password allows access only to the MySQL database. Use the following steps to reset a MySQL root password by using the command line interface. Stop the MySQL service. The steps involved in resetting the MySQL root password are to stop the MySQL server, restart it without the permissions active so you can log into MySQL as root without a password, set a new password, and then restart it normally.
Active1 year ago
Reset a lost MySQL root password 1) sudo service mysql stop 2) sudo mysqldsafe -skip-grant-tables & 3) mysql -uroot.use mysql;.update user set password=P.
I just reinstalled MySQL using brew on my mac.As far as I can see everything works fine, but I cannot change my root password.
When trying I'm getting this error message:
The common way to solve this seems to use (several answers on stack overflow suggest using this):
![]()
I stopped the server before executing the command. But this solution does not work for me.
There is also no entry in the error log:
I read also about using
mysql_secure_installation but there I get just the same error message as when using mysql -u root .
As I mentioned above, I tried already to just uninstall and reinstall it again, but obviously some data remained. So is there maybe any way to manually delete or reset these files?
blue-phoenox
blue-phoenoxblue-phoenox
5,8941212 gold badges2727 silver badges6060 bronze badges
2 Answers
Solution by OP.
It turned out that:
(not sure if
sudo is necessary)
works for me.
How To Reset Lost Root Password In The Mysql Reference Manual Mac Os
The access denied is because you're not specifying the -p switchIf you know the old password then maybe login to MySql and change it as: 1).login to MySql 2).change to the correct db 3) change the passwd and flush
mysql> flush privileges; mysql> quit
How To Reset Lost Root Password In The Mysql Reference Manual Mac Pro
Also, the following works in Linux/Unix systems but i haven't tested it on Mac (may work if you have the clients installed)
How To Reset Lost Root Password In The Mysql Reference Manual Machine
Reference: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
How To Reset Lost Root Password In The Mysql Reference Manual Mac Pro
//If you don't remember the password, to recover it check this out(bottom).
Salah-1Salah-1
Not the answer you're looking for? Browse other questions tagged mysqlmacospasswords or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |