WebFaction
Community site: login faq

Specifically, is there a way I could list off all of my MySQL databases without creating an account using the Control Panel and giving it access to all of the DBs manually?

Essentially I'd like to just call show databases; and then use awk or egrep or something and grab the names of each of the databases.

asked 19 Jul '13, 19:46

tigersheep
111
accept rate: 0%


You can make use of our XML-RPC API to get such results.

A python script similar to this would do:

#!/bin/env python2.7

import xmlrpclib
server = xmlrpclib.ServerProxy('https://api.webfaction.com/')
session_id, account = server.login('USERNAME', 'YOUR_CONTROL_PANEL_PASSWORD')
my_dbs = server.list_dbs(session_id)

for db in my_dbs:
  if db['db_type'] == "mysql":
    print db['name']

You can save this as show_mysql_databases.py for example, update your credentials on the 5th line, place it in your ~/bin directory and give it the executable mode bit with chmod u+x ~/bin/show_mysql_databases.py to run it.

permanent link

answered 20 Jul '13, 01:55

iliasr ♦♦
2.1k14
accept rate: 35%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×168
×103
×84
×25
×4

question asked: 19 Jul '13, 19:46

question was seen: 2,664 times

last updated: 20 Jul '13, 01:55

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM