Plesk SQL Queries

A few queries I put together to grab info from the Plesk database for troubleshooting:

#FTP ACCOUNTS
#————
SELECT account_id AS 'ID', login AS 'USERNAME', password AS 'PASSWORD', home AS 'HOMEDIR' FROM sys_users S, accounts A WHERE S.account_id = A.id;

#MAIL ACCOUNTS
#————-
SELECT account_id AS 'ID', mail_name AS 'USERNAME', password AS 'PASSWORD', postbox as 'MAILBOX?', name AS 'DOMAIN', redir_addr as REDIRECT FROM mail M, domains D, accounts A WHERE M.account_id = A.id AND M.dom_id = D.id ORDER BY name;

SELECT account_id AS 'ID', mail_name AS 'USERNAME', password AS 'PASSWORD', postbox as 'MAILBOX?', name AS 'DOMAIN', redir_addr as REDIRECT FROM mail M, domains D, accounts A WHERE M.account_id = A.id AND M.dom_id = D.id AND D.name='domainname.com';

#MySQL ACCOUNTS (Plesk 7)
#—————
SELECT d.name AS DOMAIN, db.name AS DB, du.login as USER, du.passwd as PASS FROM db_users du, data_bases db, domains d WHERE du.db_id = db.id AND db.dom_id=d.id ORDER BY d.name, db.name;

#MySQL ACCOUNTS (Plesk 8+)
#—————
SELECT d.name AS DOMAIN, db.name AS DB, du.login as USER, a.password as PASS FROM db_users du, data_bases db, domains d, accounts a WHERE du.db_id = db.id AND db.dom_id=d.id and du.account_id=a.id ORDER BY d.name, db.name

#CLIENT ACCOUNTS (Plesk 7)
#—————
SELECT id as 'ID', login as 'USERNAME', passwd as 'PASSWORD', cname as 'COMPANY' FROM clients ORDER BY login;

#CLIENT ACCOUNTS (Plesk 8+)
#—————
select c.id as client, a.id as account, c.login, a.password from clients c, accounts a where a.id=c.account_id;

#MEMBERS OF MAIL GROUP
#——————–
select m.mail_name AS 'GROUP', mr.address AS 'GOES TO' FROM mail_redir mr,mail m WHERE m.mail_group='TRUE' AND m.id=mr.mn_id AND m.mail_name='mailgroupname';

#WEB FORWARDING SETTINGS
#———————
select d.name, f.redirect from domains d, forwarding f where d.id=f.dom_id;

#EMAIL FORWARDING SETTINGS
#————————
select name as domain, mail_name,postbox,redirect,redir_addr from mail M, domains D where M.dom_id = D.id;

You can leave a response, or trackback from your own site.

Leave a Reply