I am on Yosemite 10.10.5 and just now I updated my outdated MySQL to the latest version. I made a copy of my existing databases /usr/local/mysql/data/ somewhere safe.

I have tried to setup MySQL both via brew & via the package installer, but seems I managed to mess up with both ways.

There is a new icon in preferences panel that was created via the package installer but it doesn't seem to start MySQL.

I tried running mysql.server start on terminal but i received the following error:

Starting MySQL
. ERROR! The server quit without updating PID file (/usr/local/var/mysql/myname.local.pid).

I tried brew services start mysql and I get:

==> Successfully started `mysql` (label: homebrew.mxcl.mysql)

But I can't access to it via Sequel Pro or via Terminal. Since brew services starts mysql, I try mysql but I get:

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

I have the following logs at /usr/local/var/mysql/myname.local.err

2016-03-30T21:58:53.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2016-03-30T21:58:53.791807Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-03-30T21:58:53.792478Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2016-03-30T21:58:53.792493Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set.
2016-03-30T21:58:53.792573Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2016-03-30T21:58:53.793639Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.11) starting as process 5922 ...
2016-03-30T21:58:53.807159Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2016-03-30T21:58:53.829847Z 0 [ERROR] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided'
2016-03-30T21:58:53.834848Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-03-30T21:58:54.063594Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/mysql-5.7.11-osx10.9-x86_64/data/ib_buffer_pool
2016-03-30T21:58:54.065139Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-03-30T21:58:54.066443Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160331  0:58:54
2016-03-30T21:58:54.073134Z 0 [Warning] System table 'plugin' is expected to be transactional.
2016-03-30T21:58:54.081061Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-03-30T21:58:54.083246Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-03-30T21:58:54.090221Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-03-30T21:58:54.090273Z 0 [Note] IPv6 is available.
2016-03-30T21:58:54.090299Z 0 [Note]   - '::' resolves to '::';
2016-03-30T21:58:54.090310Z 0 [Note] Server socket created on IP: '::'.
2016-03-30T21:58:54.091554Z 0 [Warning] Failed to open optimizer cost constant tables

2016-03-30T21:58:54.099383Z 0 [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
2016-03-30T21:58:54.099725Z 0 [ERROR] Aborting

2016-03-30T21:58:54.099763Z 0 [Note] Binlog end
2016-03-30T21:58:54.100531Z 0 [Note] Shutting down plugin 'ngram'
2016-03-30T21:58:55.476257Z 0 [Note] Shutting down plugin 'binlog'
2016-03-30T21:58:55.476370Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

2016-03-30T21:58:55.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/myuser.local.pid ended
  • Remove anything mysql/mariadb/Oracle MySQL and start over again with either homebrew mariadb/mysql or Oracle MySQL!
    – klanomath
    Commented Mar 29, 2016 at 19:07
  • hi @klanomath there is no mariadb in my setup. Plus my data where on mysql no mariadb, so in case i do so will i be able to migrate my backup db from mysql to mariadb?
    – HaCos
    Commented Mar 30, 2016 at 11:05
  • AFAIR homebrew uses mariadb - it's still called mysql though (mariadb is the "successor" of mysql)
    – klanomath
    Commented Mar 30, 2016 at 12:19
  • @klanomath mariadb is not installed in my setup. I am also missing my.cnf , doesnt exist in /etc/ or /usr/local/mysql/
    – HaCos
    Commented Mar 30, 2016 at 17:53
  • Sometimes I managed to get around errors like this by deleting .err files in /usr/local/var/mysql/ and starting MySQL.
    – pietrodn
    Commented Mar 30, 2016 at 22:28

1 Answer 1


Realized all this mess has been created because mysql has been installed via brew and via package from mysql site.

Solution for me was to remove mysql completely & reinstalled it via brew.

The new database data i created are located in /usr/local/var/mysql/

Running where mysql returns /usr/local/bin/mysql

Running mysql.server start|stop|restart seems to function ok. Also accessing db via sequel pro works ok but when i tried to setup my rails projects i run rake db:create but i received

rake aborted! LoadError: dlopen(/Users/myuser/.rvm/gems/ruby-2.2.4/extensions/x86_64-darwin-14/2.2.0/mysql2-0.4.3/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/Cellar/mysql/5.5.19/lib/libmysqlclient.18.dylib Referenced from: /Users/myuser/.rvm/gems/ruby-2.2.4/extensions/x86_64-darwin-14/2.2.0/mysql2-0.4.3/mysql2/mysql2.bundle Reason: image not found - /Users/myuser/.rvm/gems/ruby-2.2.4/extensions/x86_64-darwin-14/2.2.0/mysql2-0.4.3/mysql2/mysql2.bundle

  • libmysqlclient.18.dylib doesnt exist in my setup, nor the directory ..Cellar/mysql/5.5.19/..
  • There is usr/local/Cellar/mysql/5.7.11/lib/
  • And there is libmysqlclient.dylib -> libmysqlclient.20.dylib but no ../libmysqlclient.18.dylib in my system.

In ~/.bash_profile there is export PATH=/usr/local/bin:$PATH

In ~/.bash_rc there

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

and in ~/.zshrc there is

export PATH="/usr/local/sbin:$PATH"

Seems like i have messed up with my systems paths?

  • Your first sentence is the problem -Homebrew uses /usr/local so noting else can - the paths are correct
    – mmmmmm
    Commented Apr 4, 2016 at 9:51
  • Hi @Mark, i removed mysql completely & reinstalled it from scratch via brew. The problem is that some path or rv mor rails is looking for an older version of libmysqlclient. Any idea how to resolve this?
    – HaCos
    Commented Apr 4, 2016 at 12:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .