MySQLi Tutorial MySQLi References

mysqli refresh() Method



The mysqli::refresh() / mysqli_refresh() function flushes tables or caches, or resets the replication server information.

Syntax

//Object-oriented style
public mysqli::refresh(flags)

//Procedural style
mysqli_refresh(mysql, flags)

Parameters

mysql Required. For procedural style only: Specify a mysqli object returned by mysqli_connect() or mysqli_init().
flags

Required. Specify the options to refresh, using a bitmask of MYSQLI_REFRESH_* constants. It can take the following values:

ConstantsDescription
MYSQLI_REFRESH_GRANTRefreshes the grant tables.
MYSQLI_REFRESH_LOGFlushes the logs, like executing the FLUSH LOGS SQL statement.
MYSQLI_REFRESH_TABLESFlushes the table cache, like executing the FLUSH TABLES SQL statement.
MYSQLI_REFRESH_HOSTSFlushes the host cache, like executing the FLUSH HOSTS SQL statement.
MYSQLI_REFRESH_REPLICAAlias of MYSQLI_REFRESH_SLAVE constant. Available as of PHP 8.1.0.
MYSQLI_REFRESH_STATUSReset the status variables, like executing the FLUSH STATUS SQL statement.
MYSQLI_REFRESH_THREADSFlushes the thread cache.
MYSQLI_REFRESH_SLAVEOn a slave replication server: resets the master server information, and restarts the slave. Like executing the RESET SLAVE SQL statement.
MYSQLI_REFRESH_MASTEROn a master replication server: removes the binary log files listed in the binary log index, and truncates the index file. Like executing the RESET MASTER SQL statement.

Return Value

Returns true if the refresh was a success, otherwise false.


❮ MySQLi Functions Reference