How to make WordPress use old database?

So my files got deleted, but my old MySQL database is still there with posts. I have reinstalled WordPress and new WordPress installation is using new, empty database. How can i make it use old database?

I have tried changing DB_NAME in wp-config.php but then i just get " Error establishing a database connection" on my site…
Do I need to change DB_PASSWORD too and where can i find password for old database?

Softaculous tend to use different table prefix each time you install, so i can be wpof_, wpis_, etc, instead of just wp_.

Please check your old database and use the correct table prefix.

3 Likes

Ok I did, still the same error:" Error establishing a database connection"

I get this when i try wp-admin/ :

The database server could be connected to (which means your username and password is okay) but the epiz_34093412_wp71 database could not be selected.

  • Are you sure it exists?
  • Does the user 34093412_1 have permission to use the epiz_34093412_wp71 database?
  • On some systems the name of your database is prefixed with your username, so it would be like username_epiz_34093412_wp71. Could that be the problem?

It does exist of course and the name is correct

Try simply use epiz_34093412. Softaculous is weird here.

3 Likes

nope, same thing
could it be about DB_PASSWORD? Is it the same for both databases?

What I see as MYSQL PASSWORD in dashboard is different than DB_PASSWORD wp-config.php…

The message “Error establishing a database connection” could mean anything. It means there is an error, but no information as to what the error is.

To see the actual error, you can enable WP_DEBUG mode: Debugging in WordPress – Documentation

You should then be able to see the actual error message, and compare those against the common errors in this article:

Normally, your account username and password are also your MySQL username and password, meaning you have one user/password for all databases.

Softaculous muddies this a bit by creating its own users and passwords. If you’re migrating websites, you probably can’t use those credentials as they only have access to the specific database they were created for, not all databases in the account (I think).

So you’ll want to remove all the existing database credentials and enter the username, password, hostname and database name shown in the client area. Please don’t go mix and match credentials, it’s going to end badly.

6 Likes

To see the actual error, you can enable WP_DEBUG mode

Ok, I did

Access denied for user '34093412_1'@'192.168.0.%' to database 'epiz_34093412_wp71'

Cannot select database

and then I get the same message as I did when accessing wp-admin:

The database server could be connected to (which means your username and password is okay) but the epiz_34093412_wp71 database could not be selected.

  • Are you sure it exists?
  • Does the user 34093412_1 have permission to use the epiz_34093412_wp71 database?
  • On some systems the name of your database is prefixed with your username, so it would be like username_epiz_34093412_wp71. Could that be the problem?

change its username too

1 Like

As said by the Admin above:

You’ll need to replace your credentials with those from the client area’s “MySQL Databases” section:

6 Likes

It doesn’t work, I get this:

Warning : mysqli_real_connect(): (HY000/1045): Access denied for user ‘34093412’@‘192.168.0.5’ (using password: YES) in /home/vol2_8/epizy.com/epiz_34093412/htdocs/wp-includes/class-wpdb.php on line 2035

Deprecated : mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/vol2_8/epizy.com/epiz_34093412/htdocs/wp-includes/class-wpdb.php on line 2067

Warning : mysql_connect(): Access denied for user ‘34093412’@‘192.168.0.5’ (using password: YES) in /home/vol2_8/epizy.com/epiz_34093412/htdocs/wp-includes/class-wpdb.php on line 2067

I think I’m gonna just start again and delete old database cuz I can’t use it anyway…
This has taken enough of my time already…

That username is incorrect. It should be epiz_34093412.

Please make sure to use the EXACT credentials shown in the client area.

Another thing you could try is to export the current database, reinstall WordPress with a fresh database, and then import the backup of your old database into it.

Then you only need to change the table prefix in the wp-config.php of the new installation without having to touch the login details.

10 Likes

That username is incorrect. It should be epiz_34093412.

Now I get just white screen, no errors no nothing
It might be cuz I didn’t install old Theme

wp-admin works, all my old posts are there, so it’s probably theme error, I’m gonna install old theme on new Wordpress.
I have no idea why dashboard credentials work with old database but not with new database but it seems to work.
Thank you for the help

If WordPress is configured to use a theme that’s not installed, it will just output a blank page. That’s normal. You can reinstall the theme from wp-admin or switch to a default theme to verify your site works.

The MySQL credentials in the client area should work with all databases on the account. But you do need to use the right credentials.

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.