title: Problems installing MySQL with Homebrew on Mavericks
body: <p>I'm having insane problems installing MySQL with Homebrew on Mavericks. I know there is a similarly named topic, but I have tried everything written there along with at least 20 sites with no success trying to make it work. I tried installing with steps according to different tutorials but nothing works as it should.</p>
  
  <p>I go like this:</p>
  
  <pre><code>brew update
  brew doctor
  brew upgrade
  
  brew install mysql
  </code></pre>
  
  <p>Brew installs it in /usr/local/Cellar/mysql/5.6.16 ...</p>
  
  <p>I try connecting as Brew says: <code>mysql -uroot</code></p>
  
  <p>I make the LaunchAgents directory, link the homebrew plist file to it and launch controls: </p>
  
  <pre><code>mkdir -p ~/Library/LaunchAgents
  ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
  launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
  </code></pre>
  
  <p>after that I try and start the mysql server with <code>sudo mysql.server start</code> but I get a socket error</p>
  
  <pre><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  </code></pre>
  
  <p>I try starting the server with <code>mysqld_safe &amp;</code> but I get the following output:</p>
  
  <pre><code>[1] 69187
  Davids-MacBook-Air-5:~ davidsupan$ 140224 14:39:16 mysqld_safe Logging to     '/usr/local/var/mysql/Davids-MacBook-Air-5.local.err'.
  touch: /usr/local/var/mysql/Davids-MacBook-Air-5.local.err: Permission denied
  140224 14:39:16 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
  /usr/local/bin/mysqld_safe: line 129: /usr/local/var/mysql/Davids-MacBook-Air-5.local.err: Permission denied
  /usr/local/bin/mysqld_safe: line 166: /usr/local/var/mysql/Davids-MacBook-Air-5.local.err: Permission denied
  140224 14:39:16 mysqld_safe mysqld from pid file /usr/local/var/mysql/Davids-MacBook-Air-5.local.pid ended
  /usr/local/bin/mysqld_safe: line 129: /usr/local/var/mysql/Davids-MacBook-Air-5.local.err: Permission denied
  </code></pre>
  
  <p>The following commands seem to do the trick
      sudo chmod -R 755 /usr/local/var/mysql
      rm -Rf /usr/local/var/mysql/Davids-MacBook-Air-5.local.err</p>
  
  <pre><code>mysql.server restart
  </code></pre>
  
  <p>and the mysql server succesfully starts</p>
  
  <pre><code>Shutting down MySQL
  .. SUCCESS! 
  Starting MySQL
  . SUCCESS! 
  </code></pre>
  
  <p>Other times, no matter what I do, I keep getting the following error</p>
  
  <pre><code>ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
  </code></pre>
  
  <p>Some pages suggest doing</p>
  
  <pre><code>unset TMPDIR
  mysql_install_db --verbose --user='whoami' \\
  --basedir="$(brew --prefix mysql)" \\
  --datadir=/usr/local/var/mysql --tmpdir=/tmp
  </code></pre>
  
  <p>but I have no success mending this problem.</p>
  
  <p>Any help would be appreciated. I hope I described the problem detailed enough. If not, I would be glad to provide more information.</p>
  
  <p>EDIT: I try <strong>mysqld restart</strong> and I get even more errors:</p>
  
  <pre><code>2014-02-25 12:35:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
  2014-02-25 12:35:54 34599 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
  2014-02-25 12:35:54 34599 [Note] Plugin 'FEDERATED' is disabled.
  2014-02-25 12:35:54 34599 [Note] InnoDB: Using atomics to ref count buffer pool pages
  2014-02-25 12:35:54 34599 [Note] InnoDB: The InnoDB memory heap is disabled
  2014-02-25 12:35:54 34599 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  2014-02-25 12:35:54 34599 [Note] InnoDB: Compressed tables use zlib 1.2.3
  2014-02-25 12:35:54 34599 [Note] InnoDB: Using CPU crc32 instructions
  2014-02-25 12:35:54 34599 [Note] InnoDB: Initializing buffer pool, size = 128.0M
  2014-02-25 12:35:54 34599 [Note] InnoDB: Completed initialization of buffer pool
  2014-02-25 12:35:54 34599 [ERROR] InnoDB: ./ibdata1 can't be opened in read-write mode
  2014-02-25 12:35:54 34599 [ERROR] InnoDB: The system tablespace must be writable!
  2014-02-25 12:35:54 34599 [ERROR] Plugin 'InnoDB' init function returned error.
  2014-02-25 12:35:54 34599 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
  mysqld: Too many arguments (first extra is 'restart').
  Use --verbose --help to get a list of available options
  2014-02-25 12:35:54 34599 [ERROR] Aborting
  
  2014-02-25 12:35:54 34599 [Note] Binlog end
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'partition'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_FT_DELETED'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_METRICS'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_CMPMEM'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_CMP_RESET'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_CMP'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_LOCKS'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'INNODB_TRX'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'BLACKHOLE'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'ARCHIVE'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'MRG_MYISAM'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'MyISAM'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'MEMORY'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'CSV'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'sha256_password'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'mysql_old_password'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'mysql_native_password'
  2014-02-25 12:35:54 34599 [Note] Shutting down plugin 'binlog'
  2014-02-25 12:35:54 34599 [Note] mysqld: Shutdown complete
  </code></pre>