Name
mysql_refresh —
Synopsis
int mysql_refresh(MYSQL *mysql, unsigned int options)
Instructs the server to refresh various system operations. Which operations are refreshed depends on the second argument, which is a bitwise combination of any of the following options:
-
REFRESH_GRANT
Reloads the permissions tables. This is the same as
mysql_reload( )
or theFLUSH
PRIVILEGES
SQL command.-
REFRESH_LOG
Flushes the log files to disk and then closes and reopens them.
-
REFRESH_TABLES
Flushes any open tables to disk.
-
REFRESH_READ_LOCK
Reinstates the read lock on the database files stored on disk.
-
REFRESH_HOSTS
Reloads the internal cache MySQL keeps of known hostnames to limit DNS lookup calls.
-
REFRESH_STATUS
Refreshes the status of the server by checking the status of various internal operations.
-
REFRESH_THREADS
Clears out any dead or inactive threads from the internal cache of threads.
-
REFRESH_MASTER
Flushes, closes, and reopens the binary log that tracks all changes to MySQL tables. This log is sent to all slave servers for replication.
-
REFRESH_SLAVE
Resets the connection with any slave servers that are replicating the master MySQL server.
Example
/* Flush the log files and the table data to disk */ if (!mysql_refresh( &mysql, REFRESH_LOG|REFRESH_TABLES )) { printf("Error sending refresh command...\n"); }
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.