Avatar of doctorbill
doctorbill
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Plesk database association

I am using a Plesk control panel
I am not so familiar with this type of control panel
I Click on the domain name I want to work on
I then Click on the Wordpress link in the top right hand side of the Plesk panel
I then Click on the database tab - I see the current database name associated with this wordpress site

If I have another site in the httpdocs folder in a sub folder called wordpress2 with wordpress files
How do I associate a database with this second site

If I navigate to this site I get a error:
https://www.mainsitename.co.uk/wordpress2
"error establishing a database connection"

If I look at the database name currently associated with the site parent (If I am in the parent site - clicked on domain name) and click on the wordpress link in the top right), the associated database name is slightly different from the name in phpmyadmin
If I am in the parent site (click on domain name)  and add a database it is not being associated with anything

Sorry to be so vague but I am not sure how plesk is actually working
Help please?
PleskDatabasesWordPress

Avatar of undefined
Last Comment
David Favor

8/22/2022 - Mon
David Johnson, CD

when you setup your wordpress site use the same database but with a different prefix for the tables
David Favor

And generally, it's a very bad idea to use one database for multiple WordPress sites, as backups for each site produce a snapshot of entire database (in many cases). Also if someone moves one site, then removes all the related files + database, this destroys all sites commingled in one database.

Best to use one database for each wp-config.php file (so each site).

Also, a horrible idea to nest WordPress installs into the same directory hierarchy, as this also causes all manner of backup + security + maintenance problems.

Good Practices...

1) One database/install (wp-config.php)

2) No other non-WordPress system using any WordPress database.

3) Every install lives in a flat file hierarchy, never nested.

So likely all that's required is to create a new database, then reference the new database during when you do your new WordPress installation or if you're doing a migration, you'll restore your existing site's database into the new database you created.

So the step you're missing is likely creating your new database.
ASKER CERTIFIED SOLUTION
David Favor

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
doctorbill

ASKER
David
I take your point

This is what I need to do:
I need to replace the current wordpress site and database with a new wordpress site and database
I don't need anything from the existing site

What is the best way to do it?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
David Favor

First, you'll do this very carefully.

Here's how I do this on projects.

1) Make a backup of the existing site, using https://wordpress.org/plugins/duplicator or some similar plugin.

2) Download the installer.php + archive.zip file, saving somewhere safe.

3) Now nuke everything. Destroy the database, remove all the files.

4) Get back to an empty directory served correctly using baseline tech - HTTPS + HTTP2 + Brotli.

5) Now create a database. I use names matching sites, so for an https://dev.davidfavor.com site, I'd name the database...

df_davidfavor_dev

Open in new window


Where df is a project collection, site name, then an additional host name, if I had a host.

This way all your databases are self documenting at a glance.

However you name your databases, good to name them for easy identification.

6) Then unzip https://wordpress.org/latest.zip into your file directory. Might be via SSH, SFTP, hosting company provided mechanism.

7) Then visit https://yoursite.com/install.php answering all questions.

https://wordpress.org/support/article/how-to-install-wordpress/ provides expanded detail of these steps.
doctorbill

ASKER
The thing is I need to move my existing wordpress site to the new host
doctorbill

ASKER
Is it possible to import the exported .xml file from the wordpress site I want to migrate
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
doctorbill

ASKER
Again, using Plesk
doctorbill

ASKER
Thanks all
David Favor

1) The thing is I need to move my existing wordpress site to the new host.

Use the Duplicator plugin mentioned above.

2) Is it possible to import the exported .xml file from the wordpress site I want to migrate

Attempting to migrate using an XML export will almost surely destroy crucial parts of your site like nav, categories, tags, all other types of content.

Use Duplicator instead.

3) Again, using Plesk

Plesk has no bearing on your migration question.

The only thing you'll use Plesk for (or any other Panel system) is to create the database.

Then arrange to copy your Duplicator installer.php file + archive .zip file into your new DocumentRoot + navigate to installer.php to do your install.

You can also do this entire process using ssh from the command line.

No requirement for Plesk or any other software.
Your help has saved me hundreds of hours of internet surfing.
fblack61