|MediaWiki file: sql.php|
|Source code:||master • 1.34.0 • 1.33.2 • 1.31.6|
sql.php is a maintenance file which allows performing SQL queries.
If you give an SQL file as the first argument, it will replace MediaWiki specific code comments like
/*_*/ for the configured database prefix (among others).
If you don't give it a file, then you can query the database in an interactive fashion, similar to the MySQL command line tool.
This script is often used if you want to upgrade MediaWiki, but have a large, master/replica-database setup and don't want any downtime.
Instead of using update.php, you might use sql.php to apply database individual patches from
maintenance/archives directory on each sql server separately, taking the individual server out of rotation while the schema change runs.
Generally you should only do this if you have to - most users should use the update.php script instead.
php sql.php archives/patch-ipb_sitewide.sql
Available options for this script from the command line are:
- Allows a cluster name to be provided for the command.
- Allows for a different database to be used in the command by ID if not the current database.
- Use a slave server for the command (allows any or a specific name).