Kurt Peek
Kurt Peek

Reputation: 57691

"ERROR! MySQL server PID file could not be found!", yet a mysqld process is running on port 3306?

I notice that a mysqld process is running on port 3306:

$ sudo lsof -i :3306
COMMAND   PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
mysqld  63026 _mysql   19u  IPv6 0x67fbb37dac8af9c7      0t0  TCP *:mysql (LISTEN)

I would like to stop this process. However, if I try mysql.server stop, I get the following error:

$ mysql.server stop
 ERROR! MySQL server PID file could not be found!

I'm on MacOS, by the way. Using sudo, I'm able to find a .pid file:

$ pwd
/usr/local/mysql
$ sudo find . -name '*pid'
./data/mysqld.local.pid

However, I'm not sure whether it's the one expected by the mysql.server stop command.

The problem I'm ultimately trying to solve is that when I try the mysql command, I get the following error:

$ mysql
ERROR 1045 (28000): Access denied for user 'kurtpeek'@'localhost' (using password: NO)

I'm trying to follow the password reset instructions at https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html, but I can't seem to get past the first step, which is to stop the MySQL server. Any help would be much appreciated.

Upvotes: 2

Views: 3724

Answers (1)

Kurt Peek
Kurt Peek

Reputation: 57691

I found a high-level explanation of this problem at https://apple.stackexchange.com/questions/255671/error-mysql-server-pid-file-could-not-be-found. The server has to be stopped using the MySQL Preferences Pane:

enter image description here

Now the sudo lsof -i :3306 command doesn't show any processes running.

Upvotes: 4

Related Questions