5

I know there are tons of posts about this problem but, I have tried all the solutions I have seen, and none are working. I have been working on this for two days now...it seems like I should be able to get a simple install working. Here are the facts: I downloaded mysql-5.6.15-osx10.7-x86_64.dmg from the MySQL site. I opened and ran the mysql-5.6.15-osx10.7-x86_64.pkg. Then I went to the command line and tried a long list of commands to start MySQL and NOTHING works.

Here is a list of some of my attempts and their results:

~ $ mysql

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

~ $ mysqld

2014-01-13 19:52:20 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2014-01-13 19:52:20 0 [Warning] Using unique option prefix thread_cache instead of thread_cache_size is deprecated and will be removed in a future release. Please use the full name instead.
2014-01-13 19:52:20 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-01-13 19:52:20 953 [Warning] Can't create test file /usr/local/mysql-5.6.15-osx10.7-x86_64/data/rogerknwlessmbp.lower-test
2014-01-13 19:52:20 953 [Warning] Can't create test file /usr/local/mysql-5.6.15-osx10.7-x86_64/data/rogerknwlessmbp.lower-test
mysqld: File './mysql-bin.index' not found (Errcode: 13 - Permission denied)
2014-01-13 19:52:20 953 [ERROR] Aborting

~ $ sudo mysqld

After several warnings about deprecated settings, I got:

2014-01-13 20:27:55 1311 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2014-01-13 20:27:55 1311 [ERROR] Aborting
2014-01-13 20:27:55 1311 [Note] Binlog end

~ $ sudo /usr/local/mysql/bin/mysqld_safe

140113 20:30:08 mysqld_safe Logging to '/usr/local/mysql/data/rogerknwlessmbp.err'.
140113 20:30:09 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
140113 20:30:11 mysqld_safe mysqld from pid file /usr/local/mysql/data/rogerknwlessmbp.pid ended

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

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

I read one post that said this was a permissions issue, and that the solution was to rebuild permissions using the Disk Utility app in Mac OS X. I have done that with no effect.

Over the past few days, I have tried so many things, I can't keep track but, they all get about the same results. I have tried installing earlier versions, different versions (x86), and on and on. If anyone has a recommendation as to what else I might try I would really appreciate it. I would love to get MySQL working on this machine. It was on my machine and working at one point but, I uninstalled it because of some problems I was having long ago. Now, I can't get it to work.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
rogdawg
  • 687
  • 3
  • 11
  • 33

6 Answers6

1

Thanks for any advice you can give.

I believe socket should link to /var/lib/mysql/mysql.sock

You can edit a file that is usually in /etc/mysql/ folder and fine a line starting with socket=

Try putting /var/lib/mysql/mysql.sock as a value for this.

I believe you can see a location for mysql.sock by running this command

$ mysqladmin variables | grep socket

If it's /tmp/mysql.sock

you can try sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock too

dachi
  • 1,604
  • 11
  • 15
  • Thank you for responding. It is my understanding that starting the server will create the mysql.sock file in the appropriate place. I checked my machine after the install and there was no mysql.sock file anywhere on it. I tried creating a mysql.sock file in the appropriate place (just created an empty file there using the "touch" command) but, it had no positive effect. – rogdawg Jan 14 '14 at 02:01
  • And is that file that you created by `touch` referred in ocnfiguration file? – dachi Jan 14 '14 at 02:03
  • `sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock` I think configuration file or similar symlink should be fine – dachi Jan 14 '14 at 02:05
  • Thanks for following up. I tried creating the link but, that hasn't helped. When I try to start mysql, I still get the "The server quit without updating the PID file..." Thanks again – rogdawg Jan 14 '14 at 02:39
  • Did you install mysql with brew? In this case, did you follow instructions to do `unset TMPDIR` and `mysql_install_db --verbose --user=`YOUR_USER` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp` ... Maybe make sure this because this deals with PID, I guess. Start server with `mysql.server start` manually – dachi Jan 14 '14 at 02:44
  • I didn't use brew. I downloaded the dmg from MySQL web site. I am using the mysql.server command to start the server. Thanks. – rogdawg Jan 14 '14 at 02:46
  • 1
    Well, don't know then, I know that there is "2000 MySQL socket error" as I read somewhere, that can be fixed as I described, like `sudo mkdir /var/mysql` and `sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock` I have no idea what else can I tell without any other info. Maybe someone else will help you a bit. – dachi Jan 14 '14 at 02:51
  • Thanks very much for your efforts, dachi. I appreciate it. When I find cause of this problem, I am sure it will be some version of "user error"! :-) – rogdawg Jan 14 '14 at 03:16
1

Finally! I got it to install and to start.

Essentially, the turning point was viewing the installation logs and working through the errors that were reported there. I had not completely removed all the old files, and one of them was causing an error.

If you are installing onto mac using the .dmg file, you can hit Ctrl+L to view the log file, and identify, specifically, what the problems are.

rogdawg
  • 687
  • 3
  • 11
  • 33
1

The MySQL portion of this guide worked for me:

Download the “x86, 64bit” DMG version of MySQL 5.6.x for OS X 10.7 from mysql.com and install the pkg, the startup item and the pref pane.

Open the pref pane and start the MySQL Server.

Update the path by editing ~/.bash_profile and add:

export PATH=~/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH

at top of file.

Set up MySQL root password:

mysqladmin -u root password {new-password}
mysqladmin -u root> -p{new-password} -h localhost password {new-password}
mysqladmin -u root -p{new-password} reload

Clear the history file by typing history -c so that {new-password} isn’t in plain text on the disk.

Now ensure that the mysql.sock file can be found by PHP: Ensure that MySQL is running

sudo mkdir /var/mysql sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
Madbreaks
  • 19,094
  • 7
  • 58
  • 72
1

This answer on StackOverflow explains it pretty well: https://stackoverflow.com/a/15472270/1067124.

  • Backup your your /usr/local/mysql/data/ folder first
  • Delete old installation (this will also remove your data!): sudo rm /usr/local/mysql

sudo rm -rf /usr/local/mysql*

sudo rm -rf /Library/StartupItems/MySQLCOM

sudo rm -rf /Library/PreferencePanes/My*

sudo rm -rf ~/Library/PreferencePanes/My*

sudo rm -rf /Library/Receipts/mysql*

sudo rm -rf /Library/Receipts/MySQL*

sudo rm -rf /var/db/receipts/com.mysql.*

Community
  • 1
  • 1
Benedikt Köppel
  • 4,853
  • 4
  • 32
  • 42
1

OS Yosemite and Maverick has been having these issues to DYLD_LIBRAARY PATH

Found here

Please Use this link to view the answer already on stack overflow.

Community
  • 1
  • 1
technazi
  • 888
  • 4
  • 21
  • 42
0

I see someone has given an answer that works in the original poster's case, but as this is such a common problem I thought I'd post the solution I found to the same problem in my own case.

I thought I knew what I was doing as I had successfully installed MySQL (mysql-5.6.15-osx10.7-x86_64.dmg) on two machines running Mavericks following the procedures at https://discussions.apple.com/docs/DOC-3082, which also allow you to install Perl drivers. However when I tried on a laptop that had previously been running Snow Leopard (sic) I hit the dreaded error message, and although a mysql directory had been generated at /var/mysql/ no socket was generated there or anywhere else.

The problem must have been caused by the previous version of MySQL I had installed, as the solution was to do a complete uninstall (http://johnmcostaiii.net/2011/removing-mysql-osx-lion/) and then reinstall. So if you have a early version of MySQL installed and you hit this problem, this might be the solution. It worked for me.

David
  • 1,018
  • 13
  • 22