WebFaction
Community site: login faq

Hi,

I'm trying to drop my database and create a new one through the command line. I login using psql -U username and then do a connect template1, followed by a DROP DATABASE databasename;

I get the error 'database databasename is being accessed by other users'. I shutdown apache and tried this and am still getting this error. Am I doing something wrong?

Thanks

EDIT:

Traceback (most recent call last): File "drop.py", line 4, in <module> server.delete_db(session_id, 'abcd', 'postgresql') File "/usr/local/lib/python2.7/xmlrpclib.py", line 1224, in call return self.send(self.name, args) File "/usr/local/lib/python2.7/xmlrpclib.py", line 1570, in request verbose=self.verbose File "/usr/local/lib/python2.7/xmlrpclib.py", line 1264, in request return self.single_request(host, handler, request_body, verbose) File "/usr/local/lib/python2.7/xmlrpclib.py", line 1297, in single_request return self.parse_response(response) File "/usr/local/lib/python2.7/xmlrpclib.py", line 1468, in parse_response return u.close() File "/usr/local/lib/python2.7/xmlrpclib.py", line 793, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <fault 1:="" 'database="" "abcd"="" is="" being="" accessed="" by="" other="" usersklzzwxh:0002'="">

asked 15 Aug '11, 23:42

iman453
491527
accept rate: 0%

edited 16 Aug '11, 00:20

Can you try deleting the database from the panel as described here?

http://docs.webfaction.com/user-guide/databases.html#delete-a-database

(16 Aug '11, 00:08) neeravk

Thanks for your reply. I am not able to. Once I click on the delete button it takes me to an error page.

(16 Aug '11, 00:22) iman453

Did you also comment out the crontab for your app that restarts it?

If not, can you try doing that using "crontab -e"?

(16 Aug '11, 00:38) neeravk

I forgot that, but I'm still getting that error after commenting it out, stopping apache and running the api commands.

(16 Aug '11, 00:43) iman453

Also when I try to kill the running processes through phppgadmin, I get the error "SQL error:

ERROR: must be superuser to signal other server processes"

(16 Aug '11, 00:47) iman453

Can you file a support ticket so that we can take an further look into this problem?

(16 Aug '11, 00:49) neeravk

Do I do that through the contact us page? http://www.webfaction.com/contact

(16 Aug '11, 00:56) iman453

You can do that through our ticketing system at:

https://help.webfaction.com/

(16 Aug '11, 01:03) neeravk
showing 5 of 8 show 3 more comments

Dropping and creating tables through the psql interface is standard, but creating and deleting actual databases are normally done through the Control Panel API. Otherwise, the list of databases for your user could get out-of-sync with those in the Control Panel.

Creating and deleting databases using our API is quite simple; please see the syntax reference.

In Python, this would be as simple as something like this (for mysql, similar for postgresql):

import xmlrpclib
server = xmlrpclib.ServerProxy('https://api.webfaction.com/')
session_id, account = server.login('username', 'password')
server.delete_db(session_id, 'username_dbname', 'mysql')
server.create_db(session_id, 'username_dbname', 'mysql', 'db_password')

Hope that helps!

permanent link

answered 16 Aug '11, 00:10

ryans ♦♦
5.0k93460
accept rate: 43%

edited 16 Aug '11, 00:20

Thanks for your reply ryans. I get the same database is being accessed by other users error when I try and drop my database using the api. (I've edited my question to have the stacktrace)

(16 Aug '11, 00:16) iman453
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:

×225
×109
×84

question asked: 15 Aug '11, 23:42

question was seen: 4,821 times

last updated: 16 Aug '11, 01:03

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