We help IT Professionals succeed at work.

Plesk database association

doctorbill
doctorbill asked
on
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?
Comment
Watch Question

Top Expert 2016

Commented:
when you setup your wordpress site use the same database but with a different prefix for the tables
David FavorFractional CTO
Distinguished Expert 2018

Commented:
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.
Fractional CTO
Distinguished Expert 2018
Commented:
https://www.a2hosting.com/kb/plesk/plesk-windows-features/installable-applications/using-plesk-to-install-wordpress provides one guide for WordPress Plesk setup. There are many other of these guides you can read also.

Search - plesk wordpress install example OR tutorial - for a very long list.

Author

Commented:
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?
David FavorFractional CTO
Distinguished Expert 2018

Commented:
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.

Author

Commented:
The thing is I need to move my existing wordpress site to the new host

Author

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

Author

Commented:
Again, using Plesk

Author

Commented:
Thanks all
David FavorFractional CTO
Distinguished Expert 2018

Commented:
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.