Brew 卸载MySql以及安装Mysql
1.brew remove mysql
2.brew cleanup
3.launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist
4.rm ~/Library/LaunchAgents/com.mysql.mysqld.plist
5.sudo rm -rf
卸载: 1.brew remove mysql 2.brew cleanup 3.launchctl unload -w ~/Library/LaunchAgents/com.mysql.mysqld.plist 4.rm ~/Library/LaunchAgents/com.mysql.mysqld.plist 5.sudo rm -rf /usr/local/var/mysql 安装 使用homebrew一键安装相应的包,因为homebrew会检测最新的版本mysql卸载,所以下载的mysql版本是5.7.*版本 最近安装的时候最新版本更新到8.x版本, 关于homebrew的安装,链接 ? /usr/bin/ruby -e "$(curl -fsSL )" 搜索一下mysql版本: brew search mysql ==> Formulaeautomysqlbackupmysql-clustermysql-search-replace mysql@5.7mysqlmysql-connector-cmysql-utilitiesmysqltunermysql++mysql-connector-c++ mysql@5.5mysql-clientmysql-sandboxmysql@5.6==> Caskshomebrew/cask/mysql-connector-pythonhomebrew/cask/navicat-for-mysqlhomebrew/cask/mysql-shellhomebrew/cask/sqlpro-for-mysqlhomebrew/cask/mysql-utilities 安装mysql: ? brew install mysql@5.7? ln -sfv /usr/local/opt/mysql@5.7/*.plist ~/Library/LaunchAgents? mysql.server start 如果mysql.server start说zsh: command not found: mysql.server的话,配置一下环境变量,如果是卸载重新切换版本的话brew link mysql@5.7 上面的第二步骤是设置开机启动 登录 ? mysql -uroot show databases;+--------------------+| Database|+--------------------+| information_schema || mysql|| performance_schema || sys|+--------------------+4 rows in set (0.00 sec) 修改root密码 use mysqlupdate user set authentication_string = password('root') where User='root';Query OK, 1 row affected, 1 warning (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 1 以前修改mysql密码字段是Password这个字段,但是mysql5.7没有这个字段而是使用了authentication_string替代 mysql> flush privileges;Query OK, 0 rows affected (0.00 sec) 如果操作过程中报下面的错误 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 那么使用首先关闭mysql服务,然后以安全模式启动mysql.server start --skip-grant-tables 最后可以参考: (编辑:瑞安网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |