• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue Finding domain named from ID number using command line

Will TCSI

New Pleskian
I have a domain that was deleted through plesk but it has left behind confs ... ran a command to show the domain id , and showed up as per below..

My question is ,.. is there a command line i can run that pulls up of the domain name associated with this ID to be 100% sure before i run its delete command.?

I have found a command that pulls ID from domain name..( which didnt work for this domain as its in error...but worked for all others i tried) -- i just need one that does the reverse!
So i am 99% sure I have the right ID.. just want to be 100% sure !

Thanks All

[root@vps0 ~]# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -e "select c.id, c.objectId as 'domain_id' from Configurations c left join domains d on c.objectId=d.id where c.obje
ctType in ('domain', 'nginxDomain') and d.id is null"
+-----+-----------+
| id | domain_id |
+-----+-----------+
| 346 | 70 |
 
I don't understand what you are seeking. Something like this
SELECT id FROM domains WHERE name LIKE 'domainname' LIMIT 1;
or
SELECT name FROM domains WHERE id LIKE 'id' LIMIT 1;
?
 
Last edited:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e 'select id from domains where name="domain.tld";'
yields the ID linked with the domain name queried,

however When I use # mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e 'select id from domains where name="localchimes.com";'
It yields no answer as that domain is the faulty one ( which i am 99% sure will match ID70)

I was just seeing if there was a command the exact " reverse" process of the above where i can put in a query on the id instead , to see if it yields an associated domain name.
many thnaks
 
hi..
I am far from a mysql expert.. hence why i use plesk,, so I dont need to know mysql CLI queries....hence my struggling

i tried
[root@vps0 ~]# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e 'select domainname from domains where id="70";'
ERROR 1054 (42S22) at line 1: Unknown column 'domainname' in 'field list'

could you help with correct syntax perhaps?
Sorry to be a pain..
 
I am sorry, I made a mistake. The field name is "name", not "domainname". So correct query is:
SELECT name FROM domains WHERE id LIKE '70' LIMIT 1;
 
thanks so much.. i put in
mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e 'select name from domains where id="70";'
and saimply returned a blank line
so i am assuming i can wipe ID70 without worrying about accidentally wiping a live clients domain out
 
Did you run
# plesk repair db
before? Because a missing dataset in domains table does not necessarily mean that there are not references in other tables pointing to that set. If repair db does not show any warnings, things ought to be alright.
 
yes had run that before..

bit the bullet and tried deleting

[root@vps0 ~]# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -e "delete from Configurations where id in (70)"
[root@vps0 ~]# /usr/sbin/apachectl -t
Warning: DocumentRoot [/var/www/vhosts/localchimes.com.au/httpdocs] does not exist

gah back to square one...

looks like ill have to open a support ticket with plesk direct
thanks so much for all your help...
cheers will
 
You should not remove anything from configurations table. The "id" of a dataset of configurations table is not linked with the id of a dataset in the domains table. Further, after removing data from the Plesk DB, even if it is done correctly, you'd still need to run httpdmng --reconfigure-all to create the web server configurations.

I think, too, that letting support solve it is a good idea.
 
Back
Top