专栏首页九州牧云Uninstall all those broken versions of MySQL and re-install it with Brew on Mac Mavericks

Uninstall all those broken versions of MySQL and re-install it with Brew on Mac Mavericks

To remove an instance of MySQL from your macOS or OSX installation you need to delete a number of files via the command line, but first ensure that you have database dumps of your databases and that then the database server is not running.

Back Up any needed databases

All of them

mysqldump --all-databases > all_databases_export.sql

Or individually

mysqldump database_name > database_exportname.sql

Stop the database server

>= MySQL 5.7

sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

< MySQL 5.7

sudo /usr/local/mysql/support-files/mysql.server stop

Remove MySQL

sudo rm -rf /usr/local/mysq*
sudo rm  /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*

Edit /etc/hostconfig and remove the line MYSQLCOM=

rm -rf ~/Library/PreferencePanes/MySQL*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm -rf /private/var/db/receipts/*mysql*

That’s it MySQL is now totally removed from your system

Brew install MySQL

  • brew doctor and fix any errors
  • brew update
  • brew install mysql
  • unset TMPDIR
  • mysql_install_db --verbose --user=whoami --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
  • mysql.server start
  • run the commands Brew suggests, add MySQL to launchctl so it automatically launches at startup

Autostart MySQL on boot

brew info mysql gives you the instructions for loading MySQL at startup, but here's all you need to do:

mkdir -p ~/Library/LaunchAgents
cp `brew --prefix mysql`/*mysql*.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/*mysql*.plist

mysql should now work and be running all the time as expected

reference:

(1)https://coolestguidesontheplanet.com/remove-mysql-from-macos-or-osx-via-the-command-line/

(2)https://coderwall.com/p/os6woq/uninstall-all-those-broken-versions-of-mysql-and-re-install-it-with-brew-on-mac-mavericks

(3)http://stackoverflow.com/questions/8014500/macosx-autostart-mysql-on-boot

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • CentOS 7 安装 MySQL 5.6

    8复制解压目录下面的mysql.server文件到/etc/init.d/mysqld

    九州暮云
  • 从代码层面优化系统性能应该怎么做?

    注:在上述事例中,会话 B 会抛出死锁异常,死锁的原因就是 A 和 B 二个会话互相等待。

    九州暮云
  • Hadoop技术资料汇总(不断更新中)

    How does the HDFS balancer work internally?

    九州暮云
  • 超详细的MySQL5.6安装

    如果需要配置服务(如进行开机自启动等),可以进行配置,生产环境上如有多个实例等不建议如此配置

    July
  • mysql-8.0.11-winx64 安装配置: mysqld --initialize --console MYSQL:ERROR 1045 (28000): Access denied ...

    mysql-8.0.11-winx64 安装配置: mysqld --initialize --console MYSQL:ERROR 1045 (28000...

    一个会写诗的程序员
  • 超详细的MySQL5.6安装部署教程

    如果需要配置服务(如进行开机自启动等),可以进行配置,生产环境上如有多个实例等不建议如此配置

    July
  • MySQL体系结构及多实例

    MySQL客户端和服务器端模型 MySQL是一个典型C/S,服务器端与客户端两部分组成 服务器端程序  mysqld mysql自带的客户端(mysql mys...

    863987322
  • CentOS6.5下MySQL 5.6安装

    mysql安装包默认下载到/data/src目录下 mysql安装目录为 /data/soft/mysql mysql的数据库data目录 /data/da...

    luxixing
  • 新手001|CentOS7下源码安装MySQL5.7.6+

    MySQL 安装方式分为: 源码安装,相应系统发行包安装(如 rpm, yum, apt-get 等)。生产中比较推荐使用二进制安装。 这里给大家推荐一篇...

    wubx
  • MySQL-5.7.10主主同步的安装和配置

    这里安装的是最新的MySQL 5.7.10(5.7.12、5.7.13(后续更新版本可能类似)有些区别,安装过程中遇到错误可搜索下本文,也许可以找到解决办法...

    一见

扫码关注云+社区

领取腾讯云代金券