mysqld: Can't change dir to data. Server doesn't start
I have met same problem. In my case I had no ..\data
dir in my C:\mysql\
so I just executed mysqld --initialize
command from c:\mysql\bin\
directory and I got the data directory in c:\mysql\data
. Afterwards I could use mysqld.exe --console
command to test the server startup.
Since you used the Windows installer, everything is set up for you to run MySQL 5.7 as a Windows service, which is a great option in most cases.
Instead of running mysqld.exe
from the command line,
Win + R
- Run
services.msc
- Right-click on
MySQL57
- Start the service.
In my case, I had installed the data directory to a different location. So the data directory really wasn't in the default location. Therefore, when I ran the mysqld
command from the command prompt, I had to specify the data directory manually:
mysqld --datadir=D:/MySQLData/Data
Here's the documentation for mysqld command-line arguments.