MySQL 8: datadir

Murray Eisenberg murrayeisenberg at
Sun Oct 4 14:57:01 UTC 2020

Problem SOLVED!

Trouble was in my.cnf I had specified 

	pid-file = /opt/local/var/run/mysq8/

but apparently mysqld could not write to that directory — even though I had previously executed

	sudo chown -R _mysql:_mysql /opt/local/var/run/mysql8/ 
and when I checked there the correct ownership was in effect.

By commenting out the “pid-file=…” line in my.cnf, the mysql8-server starts normally and I can connect to it with the mysql (= mysql8) client.

Still somewhat mysterious!

> On 4 Oct2020, at 4:03 AM, Ryan Schmidt <ryandesign at> wrote:
> On Oct 3, 2020, at 12:05, Murray Eisenberg wrote:
>> On 3 Oct2020, at 8:00 AM,Andrew Udvare  wrote:
>>> Your client is trying to connect
>>> /opt/local/var/run/mysql57/mysqld.sock instead of
>>> /opt/local/var/run/mysql8/mysqld.sock . Your client is not finding the
>>> correct socket path in my.cnf. You can specify which socket to connect
>>> to manually:
>>> mysql -S /opt/local/var/run/mysql8/mysqld.sock ...
>>> If you are running mysql8, does /opt/local/var/run/mysql8/mysqld.sock
>>> exist? It may be that your my.cnf says to put it at the old path.
>> (a) No, there is no such file /opt/local/var/run/mysql8/mysql.sock ! 
>> After loading mysql8-server, the only files in  /opt/local/var/run/mysql8 are .turd_mysql8-server and
>> How is that file created?
> The server creates the socket file when it starts.
> The file presumably contains a process ID number. Is there a process currently running with that process ID number? If yes, is it mysqld? If there is no such process, or if it is not mysqld, try deleting
>> (b) Manually specifying the socket gives the same kind of error as before:
>> 		sudo port load mysql8-server
>> 	--->  Loading startupitem 'mysql8-server' for mysql8-server 
>> 	mysql -S /opt/local/var/run/mysql8/mysqld.sock
>> 	ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql8/mysqld.sock' (2)
> Then I guess there is no such socket file, perhaps because your server has not started.

Murray Eisenberg			murrayeisenberg at
503 King Farm Blvd #101	Home (240)-246-7240
Rockville, MD 20850-6667	Mobile (413)-427-5334

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list