2

I have recently installed MySQL 5.7.16 on an iMac running El Capitan. I had a few minor hiccups initially because I forgot the root password but that has now been reset and I can now log into MySQL as root user using:

$ mysql -u root -p

However, when I try to connect to MySQL server as root using SequelPro, I get the message:

Unable to connect via the socket, or the request timed out.

Double-check that the socket path is correct and that you have the necessary privileges, and that the server is running.

MySQL said: Your password has expired. To log in you must change it using a client that supports expired passwords.

When I look in /tmp folder, I was expecting to find mysql.sock but, instead, there is a file called mysql.sock.lock. Could this be causing the problem? I can't find where that .lock file has come from and I'm not sure what to do about it. Any help would be appreciated.

user1718097
  • 4,090
  • 11
  • 48
  • 63

4 Answers4

3

I'm not entirely sure what happened to cause the root password to expire but something had thrown a spanner in the works. Anyway, the solution for me was to log into MySQL from the Terminal using:

$ mysql -u root -p

...and then alter the root user's password using:

> ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPass';

That seemed to do the trick. I was then able to log in to MySQL using Sequel Pro with no problems.

user1718097
  • 4,090
  • 11
  • 48
  • 63
  • Thanks! Changing password to a new one fixed the issue for me too - now I can connect to local mysql using SequelPro. This is absolutely not an obvious solution. – AbstractVoid Oct 20 '17 at 15:55
0

Instead of using a socket connection, you could try connecting via Sequel Pro's standard connection using 127.0.0.1 as the host.

JasonJensenDev
  • 2,377
  • 21
  • 30
  • He would need to set the root password for root@'127.0.0.1' as well then. There are two entries for root by default - both localhost and 127.0.0.1. edit: this is all assuming SequelPro is running on the same machine as the DB. If not, then a remote user account and password would need to be set up. – T Gray Nov 16 '16 at 20:32
  • Yes, SequelPro is running on the same machine. I've tried connecting with 127.0.0.1 but still no joy. SequelPro is able to connect to MySQL running on a different machine with no problems. – user1718097 Nov 16 '16 at 21:03
  • Have you tried turning it off and on again? https://www.youtube.com/watch?v=nn2FB1P_Mn8 – JasonJensenDev Nov 16 '16 at 21:59
0

Thus spake the 5.7 docs:

The installation process creates only a single root account, 'root'@'localhost', automatically generates a random password for this account, and marks the password expired. The MySQL administrator must connect as root using the random password and assign a new password. (The server writes the random password to the error log.)

So, connect from terminal and change the root password.

guest
  • 41
  • 1
  • 5
0

Either your first password may not have been saved OR it just truly never persisted. For me it was the sudo /usr/local/bin/mysql_secure_installation that may not have ever persisted the password correctly. Since your first password never changed, there is no password or ,like your error said, "expired" to nothing.

Run or rerun the code above, don't type anything for the password field and follow the steps, from the preloaded setup program.