Cannot reset password for the root user in MariaDB (Mac keeps changing it on restart)

You are viewing an old version of this question. View the current version here.

I’m trying to install and setup MariaDB on my Machine (MacBook Pro M3 Max with Sonoma 14.5 OS) but it is not being possible to login anymore. The root password keeps changing after I turn off the machine and turn it on the next day.

I have followed the official instructions to install MariaDB (https://mariadb.com/resources/blog/installing-mariadb-10-1-16-on-mac-os-x-with-homebrew/) on my Machine, but it is not being possible to setup a password to my root user, which blocks completelly the usage part of `mariadb`. Also, it is also not possible to login with or without the password with my root user.

I also tried to uninstall `mariadb` and install it again, but when I run the the `mariadb-secure-installation` command (or the `mysql_secure_installation` command) and try to setup a password, the following access denied error happens:

$ mariadb-secure-installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none): 
Aborting!

Cleaning up...

I also already tried the common approach to change the root user's password by running `sudo mysqld_safe --skip-grant-tables`, then `mariadb -u root`, then the specific sql commands to reset the password. However, it doesn't work, in fact it stops at the first command and says that there is already an active `mysqld` process, which blocks the execution of additional commands.

$ sudo mariadbd-safe --skip-grant-tables

240704 20:27:52 mysqld_safe Logging to '/opt/homebrew/var/Victors-MacBook-Pro.local.err'.
240704 20:27:52 mysqld_safe Starting mariadbd daemon with databases from /opt/homebrew/var
/opt/homebrew/bin/mariadbd-safe-helper: Can't create/write to file '/opt/homebrew/var/Victors-MacBook-Pro.local.err' (Errcode: 13 "Permission denied")

↳ This error is happening even after I kill all of the `mysqld`/`mysql` active 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>`.

$ sudo mariadbd-safe --skip-grant-tables
240704 20:29:08 mysqld_safe Logging to '/opt/homebrew/var/Victors-MacBook-Pro.local.err'.
240704 20:29:08 mysqld_safe Starting mariadbd daemon with databases from /opt/homebrew/var
/opt/homebrew/bin/mariadbd-safe-helper: Can't create/write to file '/opt/homebrew/var/Victors-MacBook-Pro.local.err' (Errcode: 13 "Permission denied")

So, in the end, I can’t use MariaDB at all on my machine. Could someone knows what is the solution or help me with that?

Thanks! Best regards,

Answer

I suspect that this may be related to the bug MDEV-34422, which causes InnoDB to write corrupted write-ahead log on IBM AIX as well as Apple macOS.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.