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

后端 未结 14 1276
失恋的感觉
失恋的感觉 2020-12-07 13:16

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.         


        
相关标签:
14条回答
  • 2020-12-07 13:31

    This solution uses the windows mysql installer.

    I have tried every other way mentioned here and other related posts, but it did not solve my problem, the service just wont start, but the below approach with the mysql-installer did.

    If you still have your installer or atleast remember the version then follow below steps:

    1. Start your windows mysql installer. For me it was "mysql-installer-community-8.0.20.0"
    2. Then remove/uninstall the SQL Server and remove all configurations
    3. Manually delete the SQL Server folder from "C:\Program Files\MySQL\MySQL Server 8.0."
    4. Start your mysql installer again and install the SQL Server again

    You can check from the window's services that the MySqL Server has started.

    Hope it helps someone.

    0 讨论(0)
  • 2020-12-07 13:33

    In mysql 8.0.13 zip package initializing.

    1. Verify that data folder is empty.

    2. Under the mysql bin path run

      mysqld.exe --initialize-insecure

    3. Add to my.ini native mysql

      [mysqld]

      default_authentication_plugin=mysql_native_password

    0 讨论(0)
  • 2020-12-07 13:34

    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.

    0 讨论(0)
  • 2020-12-07 13:39

    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.
    0 讨论(0)
  • 2020-12-07 13:42
    1. Check that the director exists.
    2. If it exists make sure mysql has access rights on it (read/write). Can be a good idea to run MySQL as a system process, but not mandatory.

    If this is stil not working try having the following notation with double slashes: C:\WebSerer\MySQL\data or C:/WebServer/MySQL/data

    0 讨论(0)
  • 2020-12-07 13:42

    Check for missing folders that are required by the server, in my case it was UPLOADS folder in programData which was deleted by empty folder cleaner utility that I used earlier.

    How did I find out:

    run the server config file my.ini(in my case it was in programData) as the defaults-file param for mysqld (don't forget to use --console option to view error log on screen) 'mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini" --console'

    Error:

    mysqld: Can't read dir of 'C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\' (OS errno 2 - No such file or directory)

    Solution:

    Once I manually created the Uploads folder the server started successfully.

    0 讨论(0)
提交回复
热议问题