Skip to content

Instantly share code, notes, and snippets.

@hoshinotsuyoshi
Last active June 7, 2019 10:24
Show Gist options
  • Save hoshinotsuyoshi/bc0e8ee0e27f089d60606951e5a117eb to your computer and use it in GitHub Desktop.
Save hoshinotsuyoshi/bc0e8ee0e27f089d60606951e5a117eb to your computer and use it in GitHub Desktop.
Mojaveでmysql5.7でThe server quit without updating PID file起きたのでbrew installしなおし

アンインストール

brew uninstall --force mysql

sudo rm -rf /usr/local/mysql
sudo rm -rf /Library/StartupItems/MYSQL
sudo rm -rf /Library/PreferencePanes/MySQL.prefPane
sudo rm -rf /Library/Receipts/mysql-.pkg
sudo rm -rf /usr/local/Cellar/mysql*
sudo rm -rf /usr/local/bin/mysql*
sudo rm -rf /usr/local/var/mysql*
sudo rm -rf /usr/local/etc/my.cnf
sudo rm -rf /usr/local/share/mysql*
sudo rm -rf /usr/local/opt/mysql*

インストール

$ brew install mysql@5.7
==> Downloading https://homebrew.bintray.com/bottles/mysql@5.7-5.7.25.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/40/408e41e6b7db830398597db177df21ea28b55d3792
######################################################################## 100.0%
==> Pouring mysql@5.7-5.7.25.mojave.bottle.tar.gz
==> /usr/local/Cellar/mysql@5.7/5.7.25/bin/mysqld --initialize-insecure --user=cesario --base
==> Caveats
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 -uroot

mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have mysql@5.7 first in your PATH run:
  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc

For compilers to find mysql@5.7 you may need to set:
  export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
  export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"

For pkg-config to find mysql@5.7 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/mysql@5.7/lib/pkgconfig"


To have launchd start mysql@5.7 now and restart at login:
  brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/mysql@5.7/bin/mysql.server start
==> Summary
🍺  /usr/local/Cellar/mysql@5.7/5.7.25: 319 files, 234MB

起動

$ brew services start mysql@5.7

mysql2 gem をbundle install

$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include --with-mysql-config=/usr/local/Cellar/mysql@5.7/5.7.25/bin/mysql_config"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment