Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

two installs of mysql on osx?

Tags:

mysql

macos

I've been running MySQL Ver 14.14 Distrib 5.6.10, for osx10.6 (x86_64) for a while with no issues. I had to hard restart my laptop tonight, and a while after it started, i tried to access a dev database. I got the following error:

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

here are the commands and responses:

$ which mysql
#=> mysql: aliased to nocorrect mysql

$ unset TMPDIR
$ mysql_install_db

#=> FATAL ERROR: Could not find ./bin/my_print_defaults

$ sudo /usr/local/mysql/support-files/mysql.server start

#=> ERROR! The server quit without updating PID file (/usr/local/mysql/whoamis-MacBook-Pro.local.pid).

$ mysqld

#=> 2013-10-19 00:11:08 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-10-19 00:11:08 5029 [Warning] Can't create test file /usr/local/var/mysql/whoamis-MacBook-Pro.lower-test
2013-10-19 00:11:08 5029 [Warning] Can't create test file /usr/local/var/mysql/whoamis-MacBook-Pro.lower-test
mysqld: Can't change dir to '/usr/local/var/mysql/' (Errcode: 2 - No such file or directory)
2013-10-19 00:11:08 5029 [ERROR] Aborting

2013-10-19 00:11:08 5029 [Note] Binlog end
2013-10-19 00:11:08 5029 [Note] mysqld: Shutdown complete

$ usr/local/Cellar/mysql

sure enough, there was a mysql installation here, too. So there's one in /usr/local/mysql and there's one in /usr/local/Cellar/mysql, but there's not one in /usr/local/var which is where mysqld, at least, seems to be looking. It's worth noting that the system preferences tool as well as mySQL Workbench server tool doesn't successfully start the server, either. Any idea where to proceed from here?

like image 674
dax Avatar asked Jan 27 '26 11:01

dax


1 Answers

As per this site

$ sudo mv my.cnf old_my.cnf
$ Password:
$ sudo /usr/local/mysql/support-files/mysql.server start
  Starting MySQL
  SUCCESS!

It works! However, it's good to note that this isn't perhaps the 'best' way - as Brad Quellhorst notes in the comments:

The better advice would be "Remove anything you recently added to my.cnf and remove the file as a last resort" Unless you already have a bare-defaults my.cnf, by removing it you're destroying any configuration options in favor of defaults, which among other things, are rather insecure. Binding MySQL to all open IPs and removing any caching, replication, and data information is not the solution to a typo'd configuration statement.

like image 106
dax Avatar answered Jan 29 '26 10:01

dax