首页 > 解决方案 > 无法在我的 Mac 上运行特定版本的 mysql

问题描述

我有两个版本的mysql:

~ » brew info mysql                                                                                                                                                                  nirohayon@Nirs-MBP-2
mysql: stable 8.0.12 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/8.0/en/
Conflicts with:
  mariadb (because mysql, mariadb, and percona install the same binaries.)
  mariadb-connector-c (because both install plugins)
  mysql-cluster (because mysql, mariadb, and percona install the same binaries.)
  mysql-connector-c (because both install MySQL client libraries)
  percona-server (because mysql, mariadb, and percona install the same binaries.)
/usr/local/Cellar/mysql/5.7.20_1 (323 files, 234.8MB) *
  Poured from bottle on 2018-01-09 at 16:39:57
/usr/local/Cellar/mysql/8.0.11 (254 files, 232.6MB)
  Poured from bottle on 2018-12-26 at 20:33:05
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb
==> Dependencies
Build: cmake ✘
Required: openssl ✔
==> Requirements
Required: macOS >= 10.10 ✔
==> Caveats

当我切换到5.7.20_1- 我一切都好mysql.server startmysql打开外壳。

当我切换到8.0.11- 我去mysql.server start我得到一个错误:

... 错误!服务器退出而不更新 PID 文件 (/usr/local/var/mysql/My-MBP-2.pid)。

我不明白,我在这里想念什么?

标签: mysqlhomebrew

解决方案


您不能在同一个数据目录上运行两个 mysql 实例。

pid 文件用于保证mysqld同一数据库上同时只有一个进程在运行。

如果要同时运行 MySQL 5.7 和 MySQL 8,则必须定义两个不同的数据目录。


推荐阅读