• Resolved Xfactory

    (@xfactory)


    I had my blog working perfectly, until the database names got changed, I checked the forums here unable to apply a few of the solutions to my own problem. I just want to get that database connection established without having to reinstall anything or anything getting messed up cause at this point I can’t afford that.

Viewing 15 replies - 1 through 15 (of 16 total)
  • I had my blog working perfectly, until the database names got changed

    Did you update the wp-config.php file to reflect the new name for the database?

    Thread Starter Xfactory

    (@xfactory)

    I changed it and it did nothing, someone told me it has to do with changing something in the database names for wordpress.

    The database connection is set in wp-config

    define('DB_NAME', 'putyourdbnamehere');    // The name of the  database
    define('DB_USER', 'usernamehere');     // Your MySQL username
    define('DB_PASSWORD', 'yourpasswordhere'); // ...and password
    define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value

    Who is your host?

    Thread Starter Xfactory

    (@xfactory)

    That is what I did I edited my wp-config. I spoke to someone who knew SQL and they had informed me it had nothing to do with editing the wordpress config files, unless they are wrong they mentioned if I do that I will loose everything and it will do a reinstall which I don’t want I just want wordpress to establish that connection back with the database

    You won’t lose data as long as you don’t delete the database tables. With that said, run, run run to WordPress Backups and learn to backup your database and your WordPress files!!!!

    Once you’ve accomplished that, go back to figuring out the correct info in your wp-config.php. If you don’t know that info, ask your host.

    Thread Starter Xfactory

    (@xfactory)

    I already entered in the correct name for the DB name, “” user, “”password and nothing changed I still got the error “can’t establish a database connection”.

    Then review Editing wp-config.php or talk to your host to make sure your database server is up and running.

    Thread Starter Xfactory

    (@xfactory)

    On that “Editing wp-config.php” it shows editing the wp-config-sample.php do you edit this document or the “edit wp-config.php” ? I reviewed my “edit wp-config.php” and the table prefix are correct on my “wp-config.php” so are the odds very good that by fixing the db, name, password will fix the database connection, before I try it I want to be sure that, nothing will screw up.

    No you edit the wp-config.php file.

    The $table_prefix would not be the cause of your database connection problem. But with that said, need to make this clear…if you backed up your database then that means you likely know the names of the tables in that database. If the posts table is called wp_posts, then the $table_prefix in your wp-config.php should be ‘wp_’.

    DID YOU BACKUP YOUR DATABASE?

    Thread Starter Xfactory

    (@xfactory)

    I do have a back up of the database, but I will back up the database again. The reason why I asked it because I had to get an old database mirgrated into wordpress from someone as it was not working, I have a very high concern with editing something and it doesn’t work causing wordpress to just automaticlly run a new install, trashing my old database which was already a pain to get the old database migrated and then I’m back to where I was a few weeks ago.

    I have a very high concern with editing something and it doesn’t work causing wordpress to just automaticlly run a new install

    A new install could happen if you have the WRONG value for $table_prefix–see my explanation above.

    Thread Starter Xfactory

    (@xfactory)

    My $table_prefix in my wp-config.php file is set correctly. By editing my wp-config.php and changing the db name, password etc. Will this cause wordpress to connect back to the database (I will try tonight and back up the database first in hopes it works) ? Even though I’m going to put it into motion you sure that I’m missing changing something in or on the database ?

    If you put the correct values in wp-config.php then you should allow WordPress to access the database.

    Thread Starter Xfactory

    (@xfactory)

    I wanted to say, that I got the connection established again and everything is working. I do have a question are there any tools for word press to prepare incase something major would screw up you can just load the file, restore and you’re back in business besides I know to have a backup of the database which is done daily ?

    Sometimes hosts will backup both your files and your database and you might be able to call on them to restore. But, you should, yourself, backup both your files and your database. See WordPress backups.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Error establishing a database connection – don’t want nothing to mess up’ is closed to new replies.