• Hello,

    I get the message “Error establishing a database connection” . Mysql server is installed at the local host, I have tried connecting to mysql using the parameters I have put at the wp-config.php and I logged into the DB without any issue.

    I have double and triple checked the apache, the php, and the owner + permissions settings and they all look good.

    I get code “500” at the apache log file.

    How can I fix this? where do I start?

    Thank you,

    Meir

Viewing 5 replies - 1 through 5 (of 5 total)
  • Its ‘localhost’– one word. If you have ‘local host’ it won’t work. I am assuming this a new install and not one that used to work but is now broken. Is that correct?

    500 is a pretty serious server error. Make sure your basics work.

    1) Make sure that an ordinary .html file will load both inside and outside your WordPress directory.
    2) Try to load WordPress’s license.txt. That should bypass all of the PHP.
    3) Put <?php phpinfo(); ?> in phpinfo.php and see if that will load.
    4) If the phpinfo file loads look it over for references to MySQL. You should see something similar to this --with-mysql=/usr/local/mysql' near the top and a much longer block of information further down the file. If you don’t see that, PHP can’t connect to the MySQL server.
    5) If you do see the MYSQL references in the phpinfo file, make sure the path is correct.

    Also, what is your OS and how did you install Apache, MySQL, and PHP? Manually or from a package like MAMP or LAMP?

    Thread Starter meirhazon

    (@meirhazon)

    Hello Apljdi and thank you for helping me out.

    I have followed your instructions and everything seems to be in plcae.
    1,2,3, – worked.
    at the php info I could see –with-mysql=mysqlnd’ It might be the issue, how can it be fixed?

    the OS – centos 5.5 I have compiled apache last version with php last version.

    PHP Version 5.3.6

    [huge amount of PHP configuration information moderated – please provide a link or put into a Pastebin instead]

    Thanks so much,

    Meir

    Thread Starter meirhazon

    (@meirhazon)

    I have also used the following script to test the php – mysql connection. and the connection was successful.

    https://www.wallpaperama.com/forums/simple-php-mysql-connection-test-script-example-t5702.html

    the Apache log files show no errors at all.

    I still get the error,

    Error establishing a database connection

    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.
    ?Are you sure you have the correct username and password?
    ?Are you sure that you have typed the correct hostname?
    ?Are you sure that the database server is running?

    >> I double and triple checked and the username, password, hostname are correct and the DB is up.

    >> I have checked the DB connection with a remote and a local mysql client and it was OK with the same parameters.

    >> I have checked the php – mysql connection with the following script, with a mysql user that has a password and a mysql user who doesnt has a password. both users worked, bust mysql users didn’t work at the wp-config.php.

    https://www.wallpaperama.com/forums/simple-php-mysql-connection-test-script-example-t5702.html

    Please help….

    Meir

    Thread Starter meirhazon

    (@meirhazon)

    when using debug mode, I get,

    Warning: mysql_connect(): Premature end of data (mysqlnd_wireprotocol.c:554) in /usr/local/wordpress-website/wp-includes/wp-db.php on line 1036 Warning: mysql_connect(): OK packet 1 bytes shorter than expected in /usr/local/wordpress-website/wp-includes/wp-db.php on line 1036 Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD(‘your_existing_password’). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file in /usr/local/wordpress-website/wp-includes/wp-db.php on line 1036

    Please help,

    Thanks

    For non-programmers like me, I just went to my database, asked to change the password (in cpanel or the myadmin tool), and re-entered the same password.

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