You are browsing a read-only backup copy of Wikitech. The live site can be found at

From Wikitech-static
Jump to navigation Jump to search is a wrapper around the mysql command line client from mariadb, which is tuned for WMF production admin convenience. It is intended primarily for interactive usage, so it defaults to WMF configuration and saves typing. It requires sudo or root user privileges, to read /root's config. It is backwards compatible with the mysql command line client, but has some additional configuration changes and shortcuts:

  • It will try to force the use of TLS for any connections outside of localhost (for security), using the right CA (independently of the /etc/ configuration.
  • It will use current user's .my.cnf configuration, so typically you want to run it with sudo meaning it will try to connect as root and with the appropriate root password, depending on the role (mediawiki db vs wikireplicas, etc.)
  • It will try to complete the fully qualified name of the host, with just the hostname: So -h db1115 will be interpreted as if one had written mysql -h db1115.eqiad.wmnet
  • It will make the port easier to write, so if one writes -h db1115:3315 it will be as if one writes mysql -h db1115.eqiad.wmnet -P 3315
  • It will translate sections names into ports, based on the /etc/wmfmariadb/section_ports.csv file, generated from puppet's hiera: So if one writes -h db1115:s5 it will be as if one writes mysql -h db1115.eqiad.wmnet -P 3315 is available on cumin hosts (mysql management profile) as it requires private account information access to execute database server admin account queries. Those are cumin1001 and cumin2001 as of the writing of this lines.

Example usage

Connect quickly to a server: -h db1115

Connect quickly to a multinstance server: -h db1115:3315

Alternative syntax: -h db1115:s5

All other mysql parameters can still be used, they are just passed on: -A -h labsdb1009 enwiki_p

Faster way to query 1 time things: -h db1115 -u dump -e "SELECT @@read_only" -p

Combined with lists of host:section or host:port, it can do batch requests:

./section s5 | while read host; do -h $host -e "SELECT @@hostname, @@port"; done


Its code can be found on the WMFMariaDBpy repo.