Manual:mysql.php


DetailsEdit

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.

OptionsEdit

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


UsageEdit

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


Getting into MySQL client
Terminal


Getting list of hosts
Terminal


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' => 'master.example.org', 'user' => 'userM',  'password' =>'pwdM',  'dbname' => 'dbM',  'type' => "mysql", 'load' => 1 ],
		[ 'host' => 'slave1.example.org', 'user' => 'userS1', 'password' =>'pwdS1', 'dbname' => 'dbS1', 'type' => "mysql", 'load' => 1 ],
		[ 'host' => 'slave2.example.org', 'user' => 'userS2', 'password' =>'pwdS2', 'dbname' => 'dbS2', 'type' => "mysql", 'load' => 1 ]
   ]
];


Terminal

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