If you are using MySQL in a Mac system. And want to remove the MySQL server and it’s all files, directories from Mac for some reason. So you are in the right tutorial.
In this tutorial, you will learn how to completely remove or uninstall MySQL on Mac using a terminal.
How to Uninstall MySQL in Mac Terminal
By using the following steps, you can completely remove or uninstall mysql from mac os using the terminal:
- Step 1: Stop MySQL
- Step 2: Uninstall MySQL
- Step 3: Remove MySQL Preference Pane
- Step 4: Remove MySQL Launch Daemon
- Step 5: Remove MySQL Group
- Step 6: Verify MySQL is Uninstalled
Step 1: Stop MySQL
Firstly, open the terminal or command line and execute the following command into it to stop MySQL:
sudo /usr/local/mysql/support-files/mysql.server stop
Step 2: Uninstall MySQL
Once MySQL has been stopped, you need to execute the following command on the terminal or command line to remove or uninstall MySQL from mac os:
sudo rm -rf /usr/local/mysql*
Note:- When you have executed this command. Then if a prompt opens on your terminal, then enter your administrator’s password.
Step 3: Remove MySQL Preference Pane
MySQL also installs a preference pane in System Preferences. To remove this, navigate to System Preferences > MySQL and click on the “Remove MySQL Preferences” button.
Step 4: Remove MySQL Launch Daemon
Execute the following command on terminal to remove MySQL also installs a launch daemon:
sudo rm /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Step 5: Remove MySQL Group
Finally, you can remove the MySQL group from your Mac by executing following command on terminal:
sudo dscl . -delete /Groups/mysql
Step 6: Verify MySQL is Uninstalled
Execute the following command on terminal to verify that MySQL has been successfully uninstalled and all MySQL files and directories have been removed:
ls /usr/local/ | grep mysql
If there are no results, then MySQL has been successfully uninstalled from your Mac.
That’s it, you have learned how to completely uninstall MySQL from Mac using Terminal and also remove all MySQL-related files and directories in Mac.