NOTE: If you have multiple sites on the same hosting account, be careful and check multiple times to delete any file, folder, database and database username from your account. Otherwise, you may lose your precious site and some important files.
How To Delete A WordPress Site Completely From CPanel?
Here are a few things we need to do to completely delete a WordPress site from cPanel.
Step 1: Login To CPanel
Under the Files section, click File Manager. Click + symbol to expand public_html. Now you can see all the files for your website.
As you can see in the screenshot below, I have multiple websites. I want to delete demo.justlearnwp.com.
Step 2: How To Find The Correct Database And Username For Your WordPress Site Via CPanel?
Before deleting this site, I need to check the database name and username for this database. Double click on your site folder name to view all the files for your site.
Now right click on wp-config.php and click view.
Under MySQL database username, and The name of the database for WordPress you can see the database name and database username for this site.
It will look something like this:
/** MySQL database username */ define('DB_USER', 'leidi_jpsome');
In the above mentioned example, leidi_jpsome is database username. Save the database and database username.
Step 3: Delete The Database And Database User
Once you have confirmed the database and username, now you can delete them.
From the cPanel homepage, click on MySQL Databases. You will be redirected to the following page.
NOTE: They have edited the screenshot to hide database and usernames for security reasons. Never share your database name and database username publicly. Otherwise, bad guys can hack your site.
Just click the delete button and confirm to delete your database and do the same to delete the username for this database.
Once you have deleted the database and username, you won’t be able to access your WordPress site, because WordPress needs a database to work.
Type your domain name in the browser address bar and You should see error establishing database connection error. It means database and username for this site has been deleted successfully.
Step 4: Delete All WordPress Files From CPanel
Click on the file manager, go to public_html. Right click on your site folder name, you want to delete and click delete link.
You will see a confirmation box if you really want to delete all files. Select Yes.