
How to Install and Uninstall MySQL with Brew
November 10, 2023
Brew, a popular package manager for macOS, simplifies the process of installing and managing software like MySQL, a widely-used open-source relational database management system. This guide covers the installation and uninstallation of MySQL using Brew, including the MySQL client and Workbench, in a terminal environment.
Installing MySQL with Brew
Install Homebrew
If Homebrew is not already installed, open the terminal and run:
/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
Install MySQL
To install MySQL using Brew:
brew install mysql
Start MySQL Service
Start the MySQL service:
brew services start mysql
Secure MySQL Installation
Run the security script to secure your MySQL installation:
mysql_secure_installation
Install MySQL Workbench (Optional)
For a GUI interface, install MySQL Workbench:
brew install --cask mysqlworkbench
Uninstalling MySQL with Brew
Stop MySQL Service
Before uninstalling, stop the MySQL service:
brew services stop mysql
Uninstall MySQL
To remove MySQL:
brew uninstall mysql
Remove MySQL Data (Optional)
To completely remove MySQL data:
rm -rf /usr/local/var/mysql
Uninstall MySQL Workbench (Optional)
If MySQL Workbench was installed, uninstall it:
brew uninstall --cask mysqlworkbench
Conclusion
Using Homebrew to manage MySQL on macOS offers a streamlined approach for installation, configuration, and uninstallation. This guide should provide engineers with a clear and concise method for handling MySQL on their systems.
Basedash is the best MySQL admin panel