Unable to uninstall mysql 8.0 in macOS - mysql

I need to install an older version of mysql (5.7) and remove current (8.0) from my system. I've tried multiple possible ways for the same but I can still output after running mysql --version
mysql Ver 8.0.27 for macos11.6 on x86_64 (Homebrew)
Ran below commands but no help:
$ sudo rm /usr/local/mysql
$ sudo rm -rf /usr/local/mysql*
$ sudo rm -rf /Library/StartupItems/MySQLCOM
$ sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
$ rm -rf ~/Library/PreferencePanes/My*
$ sudo rm -rf /Library/Receipts/mysql*
$ sudo rm -rf /Library/Receipts/MySQL*
$ sudo rm -rf /private/var/db/receipts/*mysql*
$ sudo rm -rf /var/db/receipts/com.mysql.mysql*
I had installed by downloading the dmg image of the installer so removing using brew doesn't help. Any leads would help. Thanks.

Related

mysql_secure_installation is asking previous password

I am repeatedly facing issue while running mysql_secure_installation command after installing mysql version 5.7 on mac pro. I tried uninstalling the mysql with below commands
$ brew services stop mysql#5.7
$ brew unlink mysql#5.7
$ brew remove mysql#5.7
$ sudo rm /usr/local/mysql
$ sudo rm -rf /usr/local/var/mysql
$ sudo rm -rf /usr/local/mysql*
$ sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ sudo rm -rf /Library/StartupItems/MySQLCOM
$ sudo rm -rf /Library/PreferencePanes/My*
$ rm -rf ~/Library/PreferencePanes/My*
$ sudo rm -rf /Library/Receipts/mysql*
$ sudo rm -rf /Library/Receipts/MySQL*
Later I re-installed the mysql version 5.7 using homebrew and tried to set password for root user. Unfortunately, mysql_secure_installation is again asking old password to enter which I am not aware of, but I need to set new password for root user. Please help me to resolve this issue.

How to completely uninstall MySQL on MacOS

I followed another stackoverflow post to completely uninstall all instances of MySQL (I had 5..)
$ sudo rm /usr/local/mysql
$ sudo rm -rf /usr/local/mysql*
$ sudo rm -rf /Library/StartupItems/MySQLCOM
$ sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
$ rm -rf ~/Library/PreferencePanes/My*
$ sudo rm -rf /Library/Receipts/mysql*
$ sudo rm -rf /Library/Receipts/MySQL*
$ sudo rm -rf /private/var/db/receipts/*mysql*
$ sudo rm -rf /var/db/receipts/com.mysql.mysql*
And reinstalled using
brew install mysql
but when I start the server, I have to put in the old root user password, which means it's still storing the passwords somewhere.
Brew prompted me change the password which I did, and then I got this error
... Failed! Error: File './mysql/user.MYD' not found (Errcode: 2 - No such file or directory)
So clearly mysql hasn't been completely uninstalled.
Ended up solving it by running
ps -ax | grep mysql
then going to each of the folders and removing any mysql data
then uninstalling XAMPP
then restarting computer
then
brew install mysql

How to Uninstalling MariaDB and mysql

Even after doing the below steps in my Mac, I am unable to uninstall Mysql and Maria dB.
Could someone please check the below and help.
"Open a terminal window
Use mysqldump to backup your databases to text files!
Stop the database server
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/mysql

'./mysql/user.MYD' not found (Errcode: 13 - Permission denied)

I am trying to do a fresh install of Mac OSX LAMP and running the command
mysql_secure_installation
I have inputting the root password and I have to now input a new password when I'm hit with this error, has anyone got any experience with this?
Re-enter new password:
... Failed! Error: File './mysql/user.MYD' not found (Errcode: 13 - Permission denied)
Please retry to completely remove mysql by executing:
brew remove mysql
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
And then restart your computer to make sure that all the processes have been killed.
Then execute these commands to install MySQL:
brew update
brew install mysql
unset TMPDIR
mysql_install_db --verbose --user='<your-username>' --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start
This should do the trick.
I think there was a corruption within the install and decided to delete and use brew to install and all is now well! Follow these steps
Open a terminal window
Use mysqldump to backup your databases to text files!
Stop the database server
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*
Then installed via Brew
brew install mysql

Uninstall mysql on Lion?

Im currently using MAMP, but I installed the Mysql standalone before. So how can I uninstall that mysql and make sure it doesn't affect on the MAMP MySQL. Thanks.
Use the following list of commands to remove MySQL from OSX Lion :
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /var/db/receipts/com.mysql.*
Finally edit /etc/hostconfig and remove the line MYSQLCOM=-YES-