MySQL 5.5.40 was running beautifully from the command line yesterday (`mysql -u root -p
`), as well as with Python.
Well, today I installed nginx – running on OSX 10.6.8, by the way – and in the process of doing that, inadvertently (hastily? stipidly? thoughtlessly?) did a `sudo chown -R myname usr
` whoops! Well I think running `Applejack AUTO` fixed that and nginx is up and running now but MySql has become confused, and is returning (good old friend of many):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (62)
I had installed it from the dev.MySql.com repository, and it’s located at `/usr/local/mysql-5.5.40-osx10.6-x86
`.
There didn’t seem (today anyway) to be any `my.cnf` file (ran `sudo find / -name ‘my.cnf’`) aside from one associated with MAMP and some deep in a macports/tarball directory, so I copied `/usr/local/mysql-5.5.40-osx10.6-x86/my-medium.cnf
` to `/etc/my.cnf
`.
Neither was there anything located at `/tmp/mysql.sock
` so, following some SO answers I tried creating a link there, then (still not having sucess) read that:
“A socket is a special pseudo-file used for data transmission by reading and writing, not data storage.
The socket file is created when the service is started and removed when the service is terminated. The location of the file is defined in /etc/my.cnf .”
And deleted that “resource”, which took me from:
stat /tmp/mysql.sock
234881026 6555452 lrwxr-xr-x 1 mikekilmer wheel 0 21 "Sep 24 22:56:00 2014" "Sep 24 22:56:00 2014" "Sep 24 22:56:00 2014" "Sep 24 22:56:00 2014" 4096 8 0 /tmp/mysql.sock
to:
stat /tmp/mysql.sock
stat: /tmp/mysql.sock: stat: No such file or directory
Running `sudo /usr/local/mysql/support-files/mysql.server start` returns `Starting MySQL ... SUCCESS!`.
Running `mysqladmin -u root -p -h127.0.0.1 --protocol=tcp shutdown
` produces:
/usr/local/mysql/bin/mysqladmin: connect to server at '127.0.0.1' failed
error: 'Can't connect to MySQL server on '127.0.0.1' (61)'
that mysqld is running on 127.0.0.1 and that the port is 3306.
You can check this by doing 'telnet 127.0.0.1 3306'
And `telnet 127.0.0.1 3306
` returns:
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host
`ping 127.0.0.1
` seems to work properly:
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.034 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.034 ms
Tried running `brew info mysql`, even though I hadn’t used it for the install, and it returns:
mysql: stable 5.6.19
Conflicts with: mariadb, mysql-cluster, mysql-connector-c, percona-server
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/mysql.rb
==> Dependencies
Build: cmake ✘
Required: pidof ✘, openssl ✔
Which makes me wonder if there’s another version of MySQL somewhere that homebrew installed at some point.
Now I’m asking the good people at SO University.
Sometimes the users at SO do and sometimes they don’t respond to your question. However, after restoring ownership pf all the file and directories in /usr/local
to root
, reinstalling MySQL from the installer, and adding the MySQL.Prefpane, I can start the MySQL server from the Preferences panel (under “other), and am up and running:
macbookpro1:~ mikekilmer$ tail -f /usr/local/mysql/data/macbookpro1.att.net.err
tail: /usr/local/mysql/data/macbookpro1.att.net.err: Permission denied
macbookpro1:~ mikekilmer$ sudo tail -f /usr/local/mysql/data/macbookpro1.att.net.err
Password:
140925 19:05:45 [Note] /usr/local/mysql/bin/mysqld: Normal shutdown
140925 19:05:45 [Note] Event Scheduler: Purging the queue. 0 events
140925 19:05:47 [Warning] /usr/local/mysql/bin/mysqld: Forcing close of thread 12 user: 'root'
140925 19:05:47 InnoDB: Starting shutdown...
140925 19:05:48 InnoDB: Shutdown completed; log sequence number 1724225
140925 19:05:48 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
140925 19:05:48 mysqld_safe mysqld from pid file /usr/local/mysql/data/macbookpro1.att.net.pid ended
140926 11:22:59 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
140926 11:22:59 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
140926 11:22:59 [Note] Plugin 'FEDERATED' is disabled.
140926 11:22:59 InnoDB: The InnoDB memory heap is disabled
140926 11:22:59 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140926 11:22:59 InnoDB: Compressed tables use zlib 1.2.3
140926 11:22:59 InnoDB: Initializing buffer pool, size = 128.0M
140926 11:22:59 InnoDB: Completed initialization of buffer pool
140926 11:22:59 InnoDB: highest supported file format is Barracuda.
140926 11:23:00 InnoDB: Waiting for the background threads to start
140926 11:23:01 InnoDB: 5.5.40 started; log sequence number 1724225
140926 11:23:01 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
140926 11:23:01 [Note] - '0.0.0.0' resolves to '0.0.0.0';
140926 11:23:01 [Note] Server socket created on IP: '0.0.0.0'.
140926 11:23:01 [Note] Event Scheduler: Loaded 0 events
140926 11:23:01 [Note] /usr/local/mysql/bin/mysqld: ready for connections.