I run brew install mysql
or brew install mariadb
then mysql_install_db
and mysql_secure_installation
but since I don't know the mysql password I just keep getting Access denied for user 'root'@'localhost'
errors. It says it created root@localhost user with no password but I have to be the root system user. It also said it created another user without a password but I can't connect with that user either.
I've tried both of these solutions and nothing works:
Along with a couple other tutorials but it always comes back to needing to know the current password and I get stuck. Has anyone else had any luck installing mysql or mariadb on macos with brew?
Edit: I uninstalled and reinstalled and even after deleting /usr/local/var/mysql, when I run mysql_install_db it says mysql.user already exists so it can't install. How do I remove all databases when uninstalling?
Edit 2: So I think I finally managed to change the password but I keep getting this error message while trying to do mysql_secure_installation: Enter current password for root (enter for none): /usr/local/bin/mysql_secure_installation: line 249: .my.cnf.29733: Permission denied /usr/local/bin/mysql_secure_installation: line 250: .my.cnf.29733: Permission denied /usr/local/bin/mysql_secure_installation: line 251: .my.cnf.29733: Permission denied /usr/local/bin/mysql_secure_installation: line 253: .my.cnf.29733: Permission denied /usr/local/bin/mysql_secure_installation: line 218: .mysql.29733: Permission denied /usr/local/bin/mysql_secure_installation: line 220: .mysql.29733: No such file or directory