The problem is that you are not allowed to interact with the database server using the applied default settings.
From the documentation of mysql_get_server_info([$link_identifier])
:
link_identifier: The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If no connection is found or established, an E_WARNING level error is generated.
As you did not specify any connection and likely have not opened one before (at least your code does not specify it), a connection is automatically created using mysql_connect
with default parameters. If SQL safe mode is active, the user name is the owner of the server process (which you cannot override), else, the user name is specified in mysql_default_user
, which you can override by specifying a user.
To fix the issue, either explicitly open a connection to the server using mysql_connect
or modify the database configuration so that you can use the implicitly created connection.
BTW: The mysql
API of PHP is deprecated in favor of mysqli
or PDO
.