I got the same issue when not using the default "/var/lib/mysql" directory as datadir.
I set the datadir in the my.cnf file to "/data/mysql" for example. Then start MySQL service and it gets stuck with the following error :
[ERROR] --initialize specified but the data directory has files in it. Aborting.
Problem is the "/usr/share/mysql/mysql-systemd-start pre" script creates a directory mysql in the datadir before launching the initialization. It should be totally empty with no files nor folders.
I have to comment out the folder creation in the pre script.
Hello,
I got the same issue when not using the default "/var/lib/mysql" directory as datadir.
I set the datadir in the my.cnf file to "/data/mysql" for example. Then start MySQL service and it gets stuck with the following error :
[ERROR] --initialize specified but the data directory has files in it. Aborting.
Problem is the "/usr/share/ mysql/mysql- systemd- start pre" script creates a directory mysql in the datadir before launching the initialization. It should be totally empty with no files nor folders.
I have to comment out the folder creation in the pre script.