Bug #114376 Error in my.ini 'datadir' entry results in inability to connect to MySQL server
Submitted: 16 Mar 3:34 Modified: 19 Mar 11:06
Reporter: Alan Lesmerises Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:8.0 OS:Windows (11 (may affect others))
Assigned to: CPU Architecture:Any
Tags: datadir, path errors

[16 Mar 3:34] Alan Lesmerises
Description:
Initial installation entered the path in the 'my.ini' file as follows:
    datadir=C:/ProgramData/MySQL/MySQL Server 8.0\Data

This consistently resulted in the following error:
    MySQL Error 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (10061)

How to repeat:
This error had to have been introduced during the (recent) initial installation, since the 'my.ini' file had not been touched by anyone, until I corrected this bug.

A clean installation, using the defaults for a 'development computer' on a Windows PC should cause the this error to appear.

Suggested fix:
Solution to correct the error:
    Change the last backslash to a forward slash (like this)
        datadir=C:/ProgramData/MySQL/MySQL Server 8.0/Data

    or (potentially) escape the backslash (like this)
        datadir=C:/ProgramData/MySQL/MySQL Server 8.0\\Data

Suspect the installer code that creates the path entry is not using the correct path delimiter character when appending the 'Data' folder to the 'basedir' path.
[16 Mar 19:07] Alan Lesmerises
I forgot to mention that I needed to specify the 'ini' file when I started the mysql daemon (--defaults-file="C:\ProgramData\MySQL\MySQL Server 8.0\my.ini").
[19 Mar 11:06] MySQL Verification Team
Hi Mr. Lesmerises,

Thank you for your bug report.

What you have reported is truly a bug. 

However, your report is a duplicate of an already verified bug:

https://bugs.mysql.com/bug.php?id=78959

Since your bug is duplicate, we shall increase the severity of the internal version of the original bug.

Thank you.