MySQL 8: datadir

Andrew Udvare audvare at
Fri Oct 2 21:14:19 UTC 2020

On 02/10/2020 16:45, Murray Eisenberg wrote:
> I have an existing MacPorts mysql57 installation (but mysql is not currently working: the dreaded PID file cannot be found error).
> —> I have an existing mysql57 datadir, namely, as specified in /opt/local/etc/mysql57/my.cnf:
> 	datadir = /Users/murray/Databases/mysql/data
> So I’m trying anew, now with mysql8. I’ve installed mysql8-server and mysql8. And issued command:
> 	sudo port select mysql mysql8
> But I don’t want to lose the old database in that mysql587 datadir location!
> So what exactly do I do?

Stop your MySQL 5.7 database (I assume `sudo port unload mysql57` or
similar). Make sure there are no lingering mysql* processes.

Make a backup:

cp -R ~/Databases/mysql/data ~/Databases/mysql/data-backup

Move the my.cnf to the appropriate location (assumption on the
destination path).

sudo cp /opt/local/etc/mysql57/my.cnf /opt/local/etc/mysql8/my.cnf

Start mysql8.

If this has an error, stop mysql8 if necessary and you have your backup
of the data and you can go back to mysql57.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the macports-users mailing list