In PHP, mysqli_dump_debug_info() asks the MySQL server to dump debug information related to the current connection.
Object-oriented style uses $mysqli->dump_debug_info(). This is a server-side diagnostic call (COM_DEBUG) and usually requires SUPER privilege. Everyday applications rarely need it.
Syntax
Call mysqli_dump_debug_info() with the values you need. Start with this line.
PHP
mysqli_dump_debug_info($mysqli);
Call
What it does
mysqli_dump_debug_info($mysqli)
Requests a server debug dump for this connection.
$mysqli->dump_debug_info()
Object-oriented form.
mysqli_dump_debug_info($mysqli) ? "ok" : "failed"
Checks whether the server accepted the request.
Success means the server accepted the debug command, not that you will see output in PHP. Server logs or the MySQL error log may receive the dump, depending on server configuration.
Library declarations
PHP
mysqli_dump_debug_info(mysqli $mysql): bool
Parameters
Parameter
Description
mysql
Required. An open mysqli connection.
Return Value
Return Value
Description
bool
true if the server accepted the debug dump request, otherwise false.
PHP Examples
Example 1 — Call dump_debug_info on a Demo Link
Attempt the call and print the boolean result. Sample output when connected to a privileged demo database.
42000 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
How It Works
An intentionally broken INSERT is executed.
sqlstate and error describe the syntax problem.
Beginners get actionable feedback without SUPER privileges.
Sample output shows a typical syntax error string.
Frequently Asked Questions
It asks the MySQL server to produce debug information for the connection. It is a diagnostic tool, not a general-purpose logger.
Often the MySQL user lacks SUPER (or the modern equivalent privilege). Check mysqli_error() for details.
Usually into server-side logs configured by MySQL, not into a PHP return value.
Call $mysqli->dump_debug_info() with no arguments.
No. Learn connect_error, errno, error and explain plans first. Use dump_debug_info only when diagnosing the server itself.