Sample Header Ad - 728x90

Cannot reset password for the root user in MySQL

0 votes
1 answer
208 views
I’m trying to install and setup MySQL on my Machine (MacBook Pro M3 Max with Sonoma 14.5 OS) but it is not being possible to login anymore. The root password keep being changed after I shut down the machine and turn it on on the next day. When I run the the mysql_secure_installation command and try to setup a password, the following access denied error happens:
$ mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 
Error: Access denied for user 'root'@'localhost' (using password: YES)
I’ve tried to change the password for the root user by executing
sudo mysqld_safe --skip-grant-tables
, then
mysql -root
, then the commands to reset the password, but it says that a mysqld process already exists, which blocks the execution of further commands.
$ sudo mysqld_safe --skip-grant-tables

2024-07-04T17:57:49.6NZ mysqld_safe Logging to '/opt/homebrew/var/mysql/Victors-MacBook-Pro.local.err'.
2024-07-04T17:57:49.6NZ mysqld_safe A mysqld process already exists
↳ This error is happening even after I kill all the mysqld and mysql processes with
sudo kill -9
or
sudo pkill -9 mysqld
or
sudo killall -9 mysqld
or
sudo killall -9 mysqld_safe
or listing all the processes with
ps aux | grep mysql
and killing each one of them manually via
sudo kill -9
So, in the end, I can’t use MySQL at all on my machine due to this login issue. Could someone help me? Thank you!
Asked by Victor Cordeiro Costa (119 rep)
Jul 4, 2024, 08:30 PM
Last activity: Jul 22, 2024, 07:23 PM