You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dotnet/runtime#35601 introduces DbException.SqlState for .NET 5.0, for standard 5-character error codes.
SQL Server has its own incompatible numeric error code scheme, currently surfaced via SqlError.Number. However, the SQL Server ODBC driver apparently maps the native SQL Server errors to SQLSTATE values. As pointed out by @cheenamalhotra, the JDBC driver does the same, although it maps only a handful of codes (maybe the ODBC translation could be copied?)
Reacted by Cheena Malhotra, rgarrison, nyctef and David Pereira
10:14:55 AM [main] Initializing Control Panel
10:14:55 AM [main] Windows Version: Enterprise 64-bit
10:14:55 AM [main] XAMPP Version: 8.2.4
10:14:55 AM [main] Control Panel Version: 3.3.0 [ Compiled: Apr 6th 2021 ]
10:14:55 AM [main] You are not running with administrator rights! This will work for
10:14:55 AM [main] most application stuff but whenever you do something with services
10:14:55 AM [main] there will be a security dialogue or things will break! So think
10:14:55 AM [main] about running this application with administrator rights!
10:14:55 AM [main] XAMPP Installation Directory: "c:\xampp"
10:14:55 AM [main] Checking for prerequisites
10:15:29 AM [main] All prerequisites found
10:15:29 AM [main] Initializing Modules
10:15:29 AM [main] Starting Check-Timer
10:15:29 AM [main] Control Panel Ready
10:15:45 AM [mysql] Attempting to start MySQL app...
10:15:47 AM [mysql] Status change detected: running
10:15:52 AM [mysql] Status change detected: stopped
10:15:52 AM [mysql] Error: MySQL shutdown unexpectedly.
10:15:52 AM [mysql] This may be due to a blocked port, missing dependencies,
10:15:52 AM [mysql] improper privileges, a crash, or a shutdown by another method.
10:15:52 AM [mysql] Press the Logs button to view error logs and check
10:15:52 AM [mysql] the Windows Event Viewer for more clues
10:15:52 AM [mysql] If you need more help, copy and post this
10:15:52 AM [mysql] entire log window on the forums
10:16:33 AM [Apache] Attempting to start Apache app...
10:16:34 AM [Apache] Status change detected: running
Is there a way of finding out MySql Server error if the MySQL shutdown unexpectedly. I tried looking at event logs but don't understand how to fix the error. Very new to MySQL. Similar to implementation of SqlState!!? Thanks in advance.
The mssql-rs driver exposes a list of mappings; this matches the ODBC driver. The methodology is thus:
Provide a hardcoded SQLSTATE in specific scenarios when no server error number is available - typically connection establishment.
Look SqlError.Number up in this mapping table. If it matches, use that - if not, continue.
Check SqlError.Class. If it's greater than 18, the SQLSTATE is HY000. If the class is greater than 10, the SQLSTATE is 42000. Otherwise, it's 01000.
I've verified that steps 2 and 3 generate identical SQLSTATE values to the ODBC driver by connecting to a TDS server capable of issuing SQL errors with the correct number and class values.
Activity
cheenamalhotra commentedon Jul 13, 2020
Thanks @roji
Acknowledged for .NET 5.0 new APIs.
[-]Implement SqlException.SqlState[/-][+].NET 5.0 | Implement SqlException.SqlState[/+]asante07 commentedon Jun 23, 2023
10:14:55 AM [main] Initializing Control Panel
10:14:55 AM [main] Windows Version: Enterprise 64-bit
10:14:55 AM [main] XAMPP Version: 8.2.4
10:14:55 AM [main] Control Panel Version: 3.3.0 [ Compiled: Apr 6th 2021 ]
10:14:55 AM [main] You are not running with administrator rights! This will work for
10:14:55 AM [main] most application stuff but whenever you do something with services
10:14:55 AM [main] there will be a security dialogue or things will break! So think
10:14:55 AM [main] about running this application with administrator rights!
10:14:55 AM [main] XAMPP Installation Directory: "c:\xampp"
10:14:55 AM [main] Checking for prerequisites
10:15:29 AM [main] All prerequisites found
10:15:29 AM [main] Initializing Modules
10:15:29 AM [main] Starting Check-Timer
10:15:29 AM [main] Control Panel Ready
10:15:45 AM [mysql] Attempting to start MySQL app...
10:15:47 AM [mysql] Status change detected: running
10:15:52 AM [mysql] Status change detected: stopped
10:15:52 AM [mysql] Error: MySQL shutdown unexpectedly.
10:15:52 AM [mysql] This may be due to a blocked port, missing dependencies,
10:15:52 AM [mysql] improper privileges, a crash, or a shutdown by another method.
10:15:52 AM [mysql] Press the Logs button to view error logs and check
10:15:52 AM [mysql] the Windows Event Viewer for more clues
10:15:52 AM [mysql] If you need more help, copy and post this
10:15:52 AM [mysql] entire log window on the forums
10:16:33 AM [Apache] Attempting to start Apache app...
10:16:34 AM [Apache] Status change detected: running
Is there a way of finding out MySql Server error if the MySQL shutdown unexpectedly. I tried looking at event logs but don't understand how to fix the error. Very new to MySQL. Similar to implementation of SqlState!!? Thanks in advance.
ErikEJ commentedon Jun 23, 2023
@asante07 I think you are asking in the wrong place...
edwardneal commentedon Sep 2, 2026
The mssql-rs driver exposes a list of mappings; this matches the ODBC driver. The methodology is thus:
SqlError.Numberup in this mapping table. If it matches, use that - if not, continue.SqlError.Class. If it's greater than 18, the SQLSTATE is HY000. If the class is greater than 10, the SQLSTATE is 42000. Otherwise, it's 01000.I've verified that steps 2 and 3 generate identical SQLSTATE values to the ODBC driver by connecting to a TDS server capable of issuing SQL errors with the correct number and class values.
priyankatiwari08 commentedon Sep 17, 2026
/triage