• thinhduckhoi

    (@thinhduckhoi)


    Hi guys,
    Here’s my problem. I use mysqldump to backup the Mysql database of WordPress from old server, then i created one new EC2 instance,installed mysql,created new databases with new user, password and restore the backup-file into this instance.
    After that, i edited the wp-config.php with the new database, user,password that i just created and restored backup-file to.
    When accessing the address of instance, let’s say 52.192.0.1/wordpress, the error said: Error establishing a database connection
    What should i do now?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter thinhduckhoi

    (@thinhduckhoi)

    One thing that’s weird is even though i deleted wp-config.php and create a new default file by use the copy command, the error still appeared.

    cp wp-config-sample.php wp-config.php
    What happend?

    Thread Starter thinhduckhoi

    (@thinhduckhoi)

    No one know about this?

    catacaustic

    (@catacaustic)

    Did you edit the wp.config.php file and enter the new databases connection details in it? That error message means that you have got an incorrect value in one or more of the database fields and that’s not allowing you to connect to the database server.

    Thread Starter thinhduckhoi

    (@thinhduckhoi)

    Actually i used mysqldump to backup and move the old mysql database and then on the new server, i created a new database with new user and new password to restore in that.After that, i edited the wp-config.php file with new value and access the wordpress page at the new server’s address.That’s it.
    And i’m sure the database was OK, not broken because the content of WordPress site on old server-side is still OK.

    Thread Starter thinhduckhoi

    (@thinhduckhoi)

    Sorry but i just moved mysql database, not html content of the old site. Could i restore the new wordpress site with just old mysql database?

    catacaustic

    (@catacaustic)

    You can, but my answer is the same as before. One or more of the details (hostname, database name, usernmae, password) is not correct in your sites wp-config.php file, and that’s what’s causing that error.

    If you are 100% sure that it’s all correct check with your hosting company and see if they can help. Sometimes you need to specify an actual hostnema or IP address as localhost won’t work. Someitmes the MySQL port number changes. There’s a couple of other things that come into play, but they would all be ocntrolled by the server and the network.

    Thread Starter thinhduckhoi

    (@thinhduckhoi)

    Mysql port number? I didn’t know about that. Because i just focus on to username, database and password. Btw, i found that when i created the new database with exact same name as the old database , it worked.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Error establishing a database connection’ is closed to new replies.