Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqld: Can't change dir to data. Server doesn't start

Tags:

mysql

I installed a MySQL server with installer and it started. After reboot I tried to start it again and get the error:

D:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld -u root -p mysqld: Can't change dir to 'D:\Program Files\MySQL\MySQL Server 5.7\data\'     (Errcode: 2 - No such file or directory) 2015-11-17T08:30:18.822962Z 0 [Warning] TIMESTAMP with implicit DEFAULT     value is deprecated. Please use --explicit_defaults_for_timestamp server option     (see documentation for more details). 2015-11-17T08:30:18.822962Z 0 [Warning] Insecure configuration for --secure-    file    -priv: Current value does not restrict location of generated files.     Consider setting it to a valid, non-empty path. 2015-11-17T08:30:18.822962Z 0 [Note] mysqld (mysqld 5.7.9) starting as     process 1108 ... 2015-11-17T08:30:18.838586Z 0 [Warning] Can't create test file D:\Program     Files\MySQL\MySQL Server 5.7\data\DESKTOP-RNBR3E8.lower-test 2015-11-17T08:30:18.838586Z 0 [Warning] Can't create test file D:\Program     Files\MySQL\MySQL Server 5.7\data\DESKTOP-RNBR3E8.lower-test 2015-11-17T08:30:18.838586Z 0 [ERROR] failed to set datadir to D:\Program     Files\MySQL\MySQL Server 5.7\data\ 2015-11-17T08:30:18.838586Z 0 [ERROR] Aborting   2015-11-17T08:30:18.838586Z 0 [Note] Binlog end 2015-11-17T08:30:18.838586Z 0 [Note] mysqld: Shutdown complete 

I tried to reinstall MySQL.
UPDATE:
When I run mysqld -u root -p as administrator, nothing happens.

like image 427
Feeco Avatar asked Nov 17 '15 08:11

Feeco


People also ask

Why does MySQL server not start?

Even with correct ownership, MySQL might fail to start up if there is other security software running on your system that manages application access to various parts of the file system. In this case, reconfigure that software to enable mysqld to access the directories it uses during normal operation.


2 Answers

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.

like image 192
keerthiprasath Avatar answered Oct 24 '22 20:10

keerthiprasath


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,

  1. Win + R
  2. Run services.msc
  3. Right-click on MySQL57
  4. Start the service.
like image 30
AaronDanielson Avatar answered Oct 24 '22 20:10

AaronDanielson