mysql.php maintenance script executes the MySQL client binary with connecting to the wiki's DB. It directly takes credential from LocalSettings.php and getting you into MySQL client binary.


mysql.php accepts following five options.

Option Required Default value
--write Connect to the primary database false
--group Specify query group false
--host Connect to a specific MySQL server false
--list-hosts List the available DB hosts false
--cluster Use an external cluster by name false
--wikidb The database wiki ID to use if not the current one false


php maintenance/mysql.php [ --write| --group| --host| --list-hosts| --cluster| --wikidb ]

Getting into MySQL client

Getting list of hosts

Getting into MySQL client with cluster

If you uses database cluster to run your wiki with $wgExternalServers. You can checkout to cluster.

$wgExternalServers = [
	'demoCluster' => [
		[ 'host' => '', 'user' => 'userM',  'password' =>'pwdM',  'dbname' => 'dbM',  'type' => "mysql", 'load' => 1 ],
		[ 'host' => '', 'user' => 'userS1', 'password' =>'pwdS1', 'dbname' => 'dbS1', 'type' => "mysql", 'load' => 1 ],
		[ 'host' => '', 'user' => 'userS2', 'password' =>'pwdS2', 'dbname' => 'dbS2', 'type' => "mysql", 'load' => 1 ]


Common errorEdit

Error: invalid cluster

This comes when wrong or non-exists cluster name is given to the script.

Error: this script only works with MySQL/MariaDB

This comes when you run script on wiki that uses sqlite.

See alsoEdit