19
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

BrewインストールしたMysqlが起動しない場合のクリーンインストール方法

Last updated at Posted at 2019-10-24

Mysqlが起動しないので色々試してみたが、brewコマンドではどうしようもなかった件

バックアップしてなかったら意味ないんだからね!👈

Mysqlが起動しない

mysqlのサービス状態をチェック

Terminal
$ brew services cleanup mysql@5.7
All user-space services OK, nothing cleaned...

$  brew services list
Name      Status  User       Plist
memcached started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.memcached.plist
mysql@5.7 started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist
redis     stopped            

startedが黄色文字になっており、mysqlコマンドを受け付けない

仕方がないのでアンインストールを試みる

Terminal
$ brew services stop mysql@5.7
Stopping `mysql@5.7`... (might take a while)
==> Successfully stopped `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)

$  brew services list
Name      Status  User       Plist
memcached started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.memcached.plist
mysql@5.7 stopped            
redis     stopped            

$ brew uninstall mysql@5.7
Uninstalling /usr/local/Cellar/mysql@5.7/5.7.28... (319 files, 231.9MB)
$  brew services list
Name      Status  User       Plist
memcached started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.memcached.plist
redis     stopped            

Brew service からも削除され、明らかにUninstallは成功している

再インストール(あくまでアンインストールからのインストール)を試みる

Terminal
$ brew install mysql@5.7
==> Downloading https://homebrew.bintray.com/bottles/mysql@5.7-5.7.28.mojave.bottle.tar.gz
Already downloaded: /Users/%user_name%/Library/Caches/Homebrew/downloads/10cf3f69c2915bcc2ceb12e669cc50e5d854b015b7870e358b64f5f5daf176da--mysql@5.7-5.7.28.mojave.bottle.tar.gz
==> Pouring mysql@5.7-5.7.28.mojave.bottle.tar.gz
==> 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"' >> ~/.bash_profile

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.28: 319 files, 231.9MB

Summaryまで出力されているので、インストールは成功したはず

Terminal
$  brew services list
Name      Status  User       Plist
memcached started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.memcached.plist
mysql@5.7 stopped            
redis     stopped            

$ brew link --force mysql@5.7
Linking /usr/local/Cellar/mysql@5.7/5.7.28... 87 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

$ grep mysql ~/.bash_profile 
$ echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

$ grep mysql ~/.bash_profile 
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"

$ mysql --version
mysql  Ver 14.14 Distrib 5.7.28, for osx10.14 (x86_64) using  EditLine wrapper

$ brew list | grep mysql
mysql@5.7

$ brew services start mysql@5.7
==> Successfully started `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)

$ brew services list
Name      Status  User       Plist
memcached started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.memcached.plist
mysql@5.7 started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist
redis     stopped            
$ mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: 
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

brewインストール版のMySQLはパスワードなしのはずであるのに、パスワードを求められる不思議
そして、brew servicesも相変わらずの黄色文字

mysqlコマンドはログインできるのか

Terminal
$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

はい、失敗です

どうすればいいのん?

改めてインストールしたmysqlの確認

Terminal
$ brew info mysql@5.7
mysql@5.7: stable 5.7.28 (bottled) [keg-only]
Open source relational database management system
https://dev.mysql.com/doc/refman/5.7/en/
/usr/local/Cellar/mysql@5.7/5.7.28 (319 files, 231.9MB) *
  Poured from bottle on 2019-10-24 at 10:36:10
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql@5.7.rb
==> Dependencies
Build: cmake ✘
Required: openssl@1.1 ✔
==> 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"' >> ~/.bash_profile

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
==> Analytics
install: 26,693 (30 days), 74,153 (90 days), 264,588 (365 days)
install_on_request: 26,239 (30 days), 73,549 (90 days), 263,444 (365 days)
build_error: 0 (30 days)

何故・・・

正しいクリーンインストール(あくまでアンインストールからのインストール 👈くどい)の正しい手順

Terminal
$ brew services stop mysql@5.7
Stopping `mysql@5.7`... (might take a while)
==> Successfully stopped `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  qt@5.5
  imagemagick

Warning: Some installed formulae are not readable:
  qt@5.5: unknown version :mountain_lion

$ brew list mysql@5.7
/usr/local/Cellar/mysql@5.7/5.7.28/.bottle/etc/my.cnf
/usr/local/Cellar/mysql@5.7/5.7.28/bin/innochecksum
/usr/local/Cellar/mysql@5.7/5.7.28/bin/lz4_decompress
/usr/local/Cellar/mysql@5.7/5.7.28/bin/my_print_defaults
/usr/local/Cellar/mysql@5.7/5.7.28/bin/myisam_ftdump
/usr/local/Cellar/mysql@5.7/5.7.28/bin/myisamchk
/usr/local/Cellar/mysql@5.7/5.7.28/bin/myisamlog
/usr/local/Cellar/mysql@5.7/5.7.28/bin/myisampack
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql.server
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_client_test
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_client_test_embedded
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_config
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_config_editor
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_embedded
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_install_db
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_plugin
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_secure_installation
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_ssl_rsa_setup
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_tzinfo_to_sql
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysql_upgrade
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqladmin
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqlbinlog
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqlcheck
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqld
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqld_multi
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqld_safe
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqldump
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqldumpslow
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqlimport
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqlpump
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqlshow
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqlslap
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqltest
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqltest_embedded
/usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqlxtest
/usr/local/Cellar/mysql@5.7/5.7.28/bin/perror
/usr/local/Cellar/mysql@5.7/5.7.28/bin/replace
/usr/local/Cellar/mysql@5.7/5.7.28/bin/resolve_stack_dump
/usr/local/Cellar/mysql@5.7/5.7.28/bin/resolveip
/usr/local/Cellar/mysql@5.7/5.7.28/bin/zlib_decompress
/usr/local/Cellar/mysql@5.7/5.7.28/homebrew.mxcl.mysql@5.7.plist
/usr/local/Cellar/mysql@5.7/5.7.28/include/mysql/ (110 files)
/usr/local/Cellar/mysql@5.7/5.7.28/lib/libmysqlclient.20.dylib
/usr/local/Cellar/mysql@5.7/5.7.28/lib/pkgconfig/mysqlclient.pc
/usr/local/Cellar/mysql@5.7/5.7.28/lib/plugin/ (51 files)
/usr/local/Cellar/mysql@5.7/5.7.28/lib/ (4 other files)
/usr/local/Cellar/mysql@5.7/5.7.28/README-test
/usr/local/Cellar/mysql@5.7/5.7.28/share/aclocal/mysql.m4
/usr/local/Cellar/mysql@5.7/5.7.28/share/doc/ (3 files)
/usr/local/Cellar/mysql@5.7/5.7.28/share/man/ (36 files)
/usr/local/Cellar/mysql@5.7/5.7.28/share/mysql/ (61 files)
/usr/local/Cellar/mysql@5.7/5.7.28/support-files/ (4 files)

$ brew uninstall mysql@5.7
Uninstalling /usr/local/Cellar/mysql@5.7/5.7.28... (319 files, 231.9MB)

$ ls -la /usr/local/Cellar/mysql@5.7/
ls: /usr/local/Cellar/mysql@5.7/: No such file or directory

$ ls -la /usr/local/Cellar/
total 0
drwxrwxr-x  53 %user_name%  admin      1696 10 24 10:43 .
drwxr-xr-x  15 root        wheel       480  5  7 13:01 ..
-rw-r--r--   1 %user_name%  admin         0 10 23 19:48 .keepme
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 autoconf
drwxr-xr-x   3 %user_name%  600333409    96  5  9 12:54 fontconfig
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 freetype
drwxr-xr-x   3 %user_name%  600333409    96  5  9 12:54 gd
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 gdbm
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 gettext
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 git
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 glib
drwxr-xr-x   3 %user_name%  600333409    96  5  9 12:54 graphviz
drwxr-xr-x   3 %user_name%  600333409    96  5  9 12:54 gts
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 ilmbase
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:37 imagemagick
drwxr-xr-x   3 %user_name%  600333409    96  5  8 10:32 imagemagick@6
drwxr-xr-x   3 %user_name%  600333409    96  5  9 12:54 jasper
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 jpeg
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 libde265
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:34 libevent
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 libffi
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 libheif
drwxr-xr-x   3 %user_name%  600333409    96  5 16 20:44 libiconv
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 libomp
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 libpng
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 libtiff
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 libtool
drwxr-xr-x   3 %user_name%  600333409    96  5 16 20:44 libxml2
drwxr-xr-x   3 %user_name%  600333409    96  5 16 20:44 libxslt
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 little-cms2
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 memcached
drwxr-xr-x   3 %user_name%  600333409    96  5  9 12:54 netpbm
drwxr-xr-x   3 %user_name%  admin        96  5  7 15:37 nodebrew
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 openexr
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:37 openjpeg
drwxr-xr-x   4 %user_name%  600333409   128 10 23 20:26 openssl
drwxr-xr-x   3 %user_name%  600333409    96 10  4 19:00 openssl@1.1
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 pcre
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 pcre2
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 pkg-config
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 python
drwxr-xr-x   3 %user_name%  600333409    96  8  6 20:01 qt
drwxr-xr-x   3 %user_name%  600333409    96  6  6 12:58 qt@5.5
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 rbenv
drwxr-xr-x   3 %user_name%  600333409    96 10  4 19:01 readline
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:35 redis
drwxr-xr-x   3 %user_name%  admin        96 10  4 19:01 ruby-build
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 shared-mime-info
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 sqlite
drwxr-xr-x   3 %user_name%  600333409    96  5  8 13:44 v8@3.15
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:37 webp
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 x265
drwxr-xr-x   3 %user_name%  600333409    96  5  7 15:36 xz

$ mysql --help | grep my.cnf
-bash: /usr/local/bin/mysql: No such file or directory

$ which mysql

$ ls -la /usr/local/var/mysql/
Patche-Kai.local.err  ib_logfile1         mysql/              test_mysql/             test/               
ib_logfile0         ibdata1             performance_schema/ test_mysql_performance/ 

# この辺りが重要(不要なアプリケーションデータを削除せよと言う事です)
$ rm -rf /usr/local/var/mysql*

$ rm -rf /usr/local/etc/my.cnf 

$ brew install mysql@5.7
==> Downloading https://homebrew.bintray.com/bottles/mysql@5.7-5.7.28.mojave.bottle.tar.gz
Already downloaded: /Users/%user_name%/Library/Caches/Homebrew/downloads/10cf3f69c2915bcc2ceb12e669cc50e5d854b015b7870e358b64f5f5daf176da--mysql@5.7-5.7.28.mojave.bottle.tar.gz
==> Pouring mysql@5.7-5.7.28.mojave.bottle.tar.gz
==> /usr/local/Cellar/mysql@5.7/5.7.28/bin/mysqld --initialize-insecure --user=%user_name% --basedir=/usr/local/Cellar/mysql@5.7/5.7.28 --datadir=/usr/loca
==> 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"' >> ~/.bash_profile

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.28: 319 files, 231.9MB

$ ls -ltr /usr/local/var/mysql/
total 221264
-rw-r-----    1 %user_name%  admin  50331648 10 24 10:45 ib_logfile1
-rw-r-----    1 %user_name%  admin        56 10 24 10:45 auto.cnf
-rw-------    1 %user_name%  admin      1676 10 24 10:45 ca-key.pem
-rw-r--r--    1 %user_name%  admin      1112 10 24 10:45 ca.pem
-rw-------    1 %user_name%  admin      1680 10 24 10:45 server-key.pem
-rw-r--r--    1 %user_name%  admin      1112 10 24 10:45 server-cert.pem
-rw-------    1 %user_name%  admin      1676 10 24 10:45 client-key.pem
-rw-r--r--    1 %user_name%  admin      1112 10 24 10:45 client-cert.pem
-rw-------    1 %user_name%  admin      1676 10 24 10:45 private_key.pem
-rw-r--r--    1 %user_name%  admin       452 10 24 10:45 public_key.pem
drwxr-x---   90 %user_name%  admin      2880 10 24 10:45 performance_schema
drwxr-x---   77 %user_name%  admin      2464 10 24 10:45 mysql
drwxr-x---  108 %user_name%  admin      3456 10 24 10:45 sys
-rw-r-----    1 %user_name%  admin       425 10 24 10:45 ib_buffer_pool
-rw-r-----    1 %user_name%  admin  50331648 10 24 10:45 ib_logfile0
-rw-r-----    1 %user_name%  admin  12582912 10 24 10:45 ibdata1


$ mysql.server start
-bash: mysql.server: command not found

# そりゃ、シムリンクせずにmysqlコマンド打ってもね(だってばよ)
$ brew link --force mysql@5.7
Linking /usr/local/Cellar/mysql@5.7/5.7.28... 87 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

$ mysql.server start
Starting MySQL
. SUCCESS! 

はい成功しました

Terminal
$ view /usr/local/var/mysql/Patche-Kai.local.err 

$ netstat -a
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
tcp4       0      0  192.168.0.5.53927   a99-999-999-99.d.https ESTABLISHED
tcp4       0      0  192.168.0.5.53926   a99-999-999-99.d.https ESTABLISHED
tcp4       0      0  192.168.0.5.53925   a99-999-999-99.d.https ESTABLISHED
tcp4       0      0  localhost.mysql        *.*                    LISTEN     
tcp4       0      0  localhost.ipp          *.*                    LISTEN     
tcp6       0      0  localhost.ipp          *.*                    LISTEN     
tcp4       0      0  192.168.0.5.53924   lb-999-99-999-99.https ESTABLISHED
tcp4       0      0  192.168.0.5.53923   server-99-999-99.https ESTABLISHED
tcp4       0      0  192.168.0.5.53922   nrt99s99-in-f99..https ESTABLISHED
tcp4       0      0  192.168.0.5.53921   nrt99s99-in-f99..https ESTABLISHED
tcp4       0      0  192.168.0.5.53887   server-99-999-99.https ESTABLISHED
tcp4       0      0  192.168.0.5.53819   lb-999-99-999-99.https ESTABLISHED
tcp4       0      0  192.168.0.5.53699   999.999.999.99.https   ESTABLISHED
tcp4       0      0  192.168.0.5.53687   999.999.999.9.https    ESTABLISHED
tcp4       0      0  192.168.0.5.53470   999.999.999.999.https  ESTABLISHED
tcp4       0      0  192.168.0.5.53417   lb-999-99-999-99.https ESTABLISHED
^C

$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
Bye

はい接続も成功です

Terminal
$ mysql.server stop
Shutting down MySQL
.. SUCCESS! 

$ brew services list
Name      Status  User       Plist
memcached started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.memcached.plist
mysql@5.7 stopped            
redis     stopped            

$ mysql.server start
Starting MySQL
. SUCCESS! 
$ brew services list
Name      Status  User       Plist
memcached started %user_name% /Users/%user_name%/Library/LaunchAgents/homebrew.mxcl.memcached.plist
mysql@5.7 stopped            
redis     stopped            

$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database test_exception_mysql;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER 'test_local'@'localhost' IDENTIFIED WITH mysql_native_password AS 'pattchepatchen1sh1teyany0';
ERROR 1827 (HY000): The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function.
mysql> CREATE USER 'test_local'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pattchepatchen1sh1teyany0';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON test_exception_mysql.* TO 'test_local'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

$ mysql -utest_local -p test_exception_mysql < test_exception_mysql_performance.sql
Enter password: 
$ mysql -utest_local -p test_exception_mysql
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.28 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

言い忘れていましたが、クラッシュする前にmysqldumpをしていた為、今回は大事に至りませんでした。
しかし、やはりバックアップはきちんと取っておきましょう。

19
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?