0

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月04日T17:57:49.6NZ mysqld_safe Logging to '/opt/homebrew/var/mysql/Victors-MacBook-Pro.local.err'.
2024年07月04日T17: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 <process_id>

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 Jul 4, 2024 at 20:30
6
  • have you even tried to search for it gist.github.com/zubaer-ahammed/c81c9a0e37adc1cb9a6cdc61c4190f52 Commented Jul 4, 2024 at 20:35
  • @nbk, yes, please read my full question. I already tried this solution, but it didn’t work. Commented Jul 4, 2024 at 20:37
  • killing the processes will not work as the service starts over again read the git page very carefully and try to follow their recomendation by the letter Commented Jul 4, 2024 at 21:04
  • Just to let everyone that reads this know. People from mariadb com solved it tinyurl.com/bd95uj83. I would like to congratulate the support of the mariadb community. If someone if facing the same issue as me, please check this link. Commented Jul 18, 2024 at 13:12
  • so answer your question by yourself and accept it Commented Jul 18, 2024 at 13:23

1 Answer 1

1

Just to let everyone know, here is the solution to this issue that can happen in MacOS Sonoma 14.5.

Remove the mysql
rm -rf /opt/homebrew/var/mysql
Install MariaDB
mariadb-install-db --user=$(whoami) --basedir="$(brew --prefix mariadb)" --datadir=/opt/homebrew/var/mysql
Login as root
sudo mysql -uroot
Change root password
set password = password("password");
exit

Now you can connect with MariaDB by mariadb -u root -ppassword anytime you want

answered Jul 22, 2024 at 19:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.