This error was returned by the Ruby on Rails command "rake db:migrate" installed on RHES and attempting to connect to a MySQL server installed via an RPM.
The RPM install puts the socket file in /var/lib/mysql/mysql.sock instead of the default /tmp/mysql.sock so the rails database.yml config file had to be updated to include the path to the socket.
Adding the line:
socket: /var/lib/mysql/mysql.sock
to the config block for the database fixed it.