I was encountering this error whilst starting mysql that was installed VIA BREW, mysql was working perfectly all this time until last week i started it and ran into this pretty fella. I get the same error when running brew services start mysql
:
\W $mysql.server start
Starting MySQL
. ERROR! The server quit without updating PID file (/opt/homebrew/var/mysql/MYDEVICE.local.pid).
What worked for me was this. I first ran brew info mysql
\W $brew info mysql
==> mysql: stable 9.0.1 (bottled)
Open source relational database management system
https://dev.mysql.com/doc/refman/9.0/en/
Conflicts with:
mariadb (because both install the same binaries)
percona-server (because both install the same binaries)
Installed
/opt/homebrew/Cellar/mysql/9.0.1_7 (324 files, 308.8MB) *
Poured from bottle using the formulae.brew.sh API on 2024-12-01 at 17:32:40
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/m/mysql.rb
License: GPL-2.0-only WITH Universal-FOSS-exception-1.0
==> Dependencies
Build: bison ✘, cmake ✘, pkgconf ✔
Required: abseil ✔, icu4c@76 ✔, lz4 ✔, openssl@3 ✔, protobuf ✔, zlib ✔, zstd ✔
==> Caveats
Upgrading from MySQL <8.4 to MySQL >9.0 requires running MySQL 8.4 first:
- brew services stop mysql
- brew install [email protected]
- brew services start [email protected]
- brew services stop [email protected]
- brew services start mysql
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -u root
To restart mysql after an upgrade:
brew services restart mysql
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/mysql/bin/mysqld_safe --datadir\=/opt/homebrew/var/mysql
==> Analytics
install: 52,958 (30 days), 178,060 (90 days), 559,619 (365 days)
install-on-request: 52,905 (30 days), 177,876 (90 days), 558,518 (365 days)
build-error: 616 (30 days)
\W $
The important bit was:
==> Caveats
Upgrading from MySQL <8.4 to MySQL >9.0 requires running MySQL 8.4 first:
- brew services stop mysql
- brew install [email protected]
- brew services start [email protected]
- brew services stop [email protected]
- brew services start mysql
So i just followed those exact steps and I no longer encountered that error when running brew services start mysql
Note: While installing version 8.4 i also ran these commands too that come whiles installing mysql8.4 (VIA BREW)
If you need to have [email protected] first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
For compilers to find [email protected] you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
For pkg-config to find [email protected] you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"
If anyone is using brew, hope this helps.