PHP mysqli: refresh() function

mysqli_refresh function / mysqli::refresh

The mysqli_refresh function / mysqli::refresh — refreshes


Object oriented style

public bool mysqli::refresh ( int $options )

Procedural style

int mysqli_refresh ( resource $link , int $options )


Name Description Required/Optional
link A link identifier returned by mysqli_connect() or mysqli_init() Required for procedural style only and Optional for Object oriented style
options The options to refresh, using the MYSQLI_REFRESH_* constants as documented within the MySQLi constants documentation. Required

Usage: Procedural style



Name Description Required / Optional
connection Specifies the MySQL connection to use Required
options The options to refresh. Can be one of more of the following (separated by OR):
  • MYSQLI_REFRESH_GRANT - Refreshes the grant tables
  • MYSQLI_REFRESH_LOG - Flushes the logs
  • MYSQLI_REFRESH_TABLES - Flushes the table cache
  • MYSQLI_REFRESH_HOSTS - Flushes the host cache
  • MYSQLI_REFRESH_STATUS - Resets the status variables
  • MYSQLI_REFRESH_THREADS - Flushes the thread cache
  • MYSQLI_REFRESH_SLAVE - Resets the master server info, and restarts the slave
  • MYSQLI_REFRESH_MASTER - Removes the binary log files in the binary log index, and truncates the index file

Return value:

TRUE if the refresh was a success, otherwise FALSE

Version: PHP 5, PHP 7


if (mysqli_connect_errno($con)){
  echo "Failed to connect to MySQL: " . mysqli_connect_error();



See also

PHP Function Reference

Previous: reap_async_query
Next: release_savepoint

Follow us on Facebook and Twitter for latest update.

PHP: Tips of the Day

PHP: How to define an empty object in PHP?

$x = new stdClass();

stdClass is the default PHP object. stdClass has no properties, methods or parent. It does not support magic methods, and implements no interfaces.

When you cast a scalar or array as Object, you get an instance of stdClass. You can use stdClass whenever you need a generic object instance.

Ref : https://bit.ly/2Q96Wvm


We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook