Link to home
Start Free TrialLog in
Avatar of Porffor
PorfforFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Urgent help needed to get my restored Wordpress site working - "Can't select database" on wp-admin

My site was in need of upgrading a few things - WP core, WPML, WooCommerce, plugins - so I got my core up to date 4.7.3 and my plugins including WPML (but I left WooCommerce as it was).  At this point I did some basic testing, and all seemed OK, so I did a full backup using UpdraftPlus, which backs up everything including the database, to a remote Google Drive location.  I've used this method to do backups/restores in the past and it's been OK.  After this I went on to upgrade WooCommerce, which required a database update.  After this, I tested my WooCommerce shop and it was a disaster - all my products were missing.

I thought I'd leave this for another day so I went to restore the full backup that I has created earlier.  I did this from within wp-admin.  Midway through, the site just crashed with a HTTP 500 error - front end and back.  Fearing the worst, I went to my Google Drive, manually downloaded the zip files, extracted, then uploaded core and the plugins folder using FTP.  After this I got "Error establishing a database connection" on the front-end, and "Can't select database" on the back-end.

The site is http://recordiaublinc.com, and the back-end is http://recordiaublinc.com/wp-admin - please see message in wp-admin for a fuller description.

To try to solve this I've logged into the phpMyAdmin, and restored the DB backup that I have over the current one.  No change.  Also I've tried renaming the current one, creating a new blank one, then diong the import, but no change either.

None of the details on wp-config.php have changed, so I can't see how this can be linked to credentials/server name, etc.

Also in desperation I've downloaded Core 4.7.3 from the Wordpress site and uploaded that, but it's still the same.

Any ideas what else I can try?

Thanks.
Avatar of Radek Baranowski
Radek Baranowski
Flag of Poland image

How big was the leap to 4.7.3?
Avatar of Porffor

ASKER

Quite big.  It was 4.1.14 before that.  But everything did seem OK after the WP upgrade.
Can recordia_admin with password login the PhpMyAdmin/MySQL and open blinc2015 database?
Avatar of Porffor

ASKER

The user used to connect WP to the DB is "recordia_admin", but I log into the cpanel (and also the FTP) with the user "recordia".  I then open phpMyAdmin as this user and I can open the blinc2015 DB.  So, when I'm logged into cpanel as "recordia", how do I log into phpMyAdmin with another user?  I've tried logging into cpanel with "recordia_admin" but I'm not allowed to.
ASKER CERTIFIED SOLUTION
Avatar of Patrick Bogers
Patrick Bogers
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Porffor

ASKER

Bingo, that worked.  I'm unfamiliar with MySQL.  I went in and saw that there was no privileged users assigned for the DB.  Once I added the user recordia_admin everything started working again.

Just to check - in order to get thingas working I selected 'ALL PRIVILEGES'.  Do I need all privileges, or are there certain privileges that will get to it work, i.e. for better security?

Thanks
there are multiple levels of security there I guess. what you use for phpMyAdmin might be irrelevant to what phpMyAdmin uses to connect to the database. connection definitions are given in phpMyAdmin config files along with database credentials., at least I had to do it so with my hosting provider.

Try to ask hosting support what's the problem behind your unable to connect to the db. If they are good support, they should give you some meaningful explanation in reasonable time.
Nice! So that one is tackled. All privileges depend... should this user be able to drop a database? All priv is good.
Should this user only add, modify and read than all privileges are not so good.

Cheers
Avatar of Porffor

ASKER

this worked
Fixed in 45 minutes, I like it.
Avatar of Porffor

ASKER

Yeah!  Should have posted this question straight away, rather than wasting hours and hours uploading files via FTP!

Great I'll leave it as All Privileges - this is the only user anyway.

Thanks