Thesql on OSX suddenly stopped functioning, unable to locate or connect

command lineMySQL

Having been using an installed version of mysql for some time without any problem, when I attempted to start the server recently it simply failed to recognise the command.

The installation is still there and I can see my databases in the filesystem. However, I cannot start the server. See the following steps, which include trying to re-add mysql to the $PATH or the bash profile, as advised in several other answers (although I don't believe this was necessary before).

pointcloud:~ james$ mysql.server start
-bash: mysql.server: command not found
pointcloud:~ james$ cd ../../usr/local/var
pointcloud:var james$ ls
cache       homebrew    log     mysql
pointcloud:var james$ cd mysql
pointcloud:mysql james$ ls
MacBook-Air.local.err           ibdata1
MacBook-Air.local.pid           ibtmp1
Otago-2.local.err           mysql
Otago-2.local.pid           mysqld_safe.pid
Pointcloud-Matrix-3885731C.local.err    otago.home.err
Pointcloud-Matrix-3885731C.local.pid    performance_schema
auto.cnf                pointcloud.err
ca-key.pem              pointcloud.local.err
ca.pem                  pointcloud.local.pid
cameras                 pointcloud.pid
client-cert.pem             pole
client-key.pem              private_key.pem
cloudpedia              public_key.pem
flightpaths             satcat
ib_logfile0             server-cert.pem
ib_logfile1             server-key.pem
pointcloud:mysql james$ echo $PATH
/Users/james/torch/install/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin
pointcloud:mysql james$ export PATH=/usr/local/var/mysql:${PATH}
pointcloud:mysql james$ echo $PATH
/usr/local/var/mysql:/Users/james/torch/install/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin
pointcloud:mysql james$ mysql.server start
-bash: mysql.server: command not found
pointcloud:mysql james$ 

Some of the other answers refer to a /bin or /support-files directory in the mysql directory. I don't seem to have these.

I'm not aware what has changed since I last started the server. I have installed a number of Homebrew and Python packages, but not anything to do with mysql, as far as I am aware.

Any assistance in restoring access to my DBs gratefully received.

Alternatively, if there is a way of re-installing Mysql while preserving and re-importing the existing DBs, this would be a possibility.

Installed system version: OSX 10.11.4 (15E65)


Edits:

I believe my mysql version was installed under homebrew, but it was some time ago (2yrs +) when I was less proficient, and I'm unable to recall the details.

brew list does not include mysql, so that is not the case.

pointcloud:mysql james$ brew list
eigen       ilmbase     libpng      opencv      python      x264
ffmpeg      jpeg        libtiff     openexr     readline    xvid
gdbm        lame        numpy       openssl     sqlite

Searching for mysql binaries in the file system:

pointcloud:var james$ sudo find / -type f -name mysql
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/Volumes/Ironside II/Backups.backupdb/pointcloud/2016-11-26-201238/Macintosh HD/usr/local/Cellar/mysql/5.6.22/bin/mysql
/Volumes/Ironside II/Backups.backupdb/pointcloud/2016-11-26-201238/Macintosh HD/usr/local/Cellar/mysql/5.7.9/bin/mysql
/Volumes/Ironside II/Backups.backupdb/pointcloud/2016-12-12-110455/Macintosh HD/usr/local/Cellar/mysql/5.6.22/bin/mysql
/Volumes/Ironside II/Backups.backupdb/pointcloud/2016-12-12-110455/Macintosh HD/usr/local/Cellar/mysql/5.7.9/bin/mysql
/Volumes/Ironside II/Backups.backupdb/pointcloud/2017-01-02-114333/Macintosh HD/usr/local/Cellar/mysql/5.6.22/bin/mysql
/Volumes/Ironside II/Backups.backupdb/pointcloud/2017-01-02-114333/Macintosh HD/usr/local/Cellar/mysql/5.7.9/bin/mysql
/Volumes/Ironside II/Backups.backupdb/pointcloud/2017-01-04-122725/Macintosh HD/usr/local/Cellar/mysql/5.6.22/bin/mysql
/Volumes/Ironside II/Backups.backupdb/pointcloud/2017-01-04-122725/Macintosh HD/usr/local/Cellar/mysql/5.7.9/bin/mysql

Best Answer

It appears, evidenced by the backups, that at some previous (recent) point, the Homebrew version of mysql was uninstalled, leaving the data intact.

Reinstalling with brew install mysql returned full functionality.