• I’ve been working on getting WordPress up and running for the better part of the day, and I’m stuck on MySQL for the moment. I’ve followed this little howto:

    https://gentoo-wiki.com/HOWTO_Apache2_with_WordPress

    And I thought I had MySQL running fine, but apparently not. I get the error establishing a database when I type the IP of my server in.

    This is my wp-config.php (Only the parts that I think are relevent to my problem)

    define(‘DB_NAME’, ‘wordpress’);
    define(‘DB_USER’, ‘wordpress’);
    define(‘DB_PASSWORD’, ‘*’);
    define(‘DB_HOST’, ‘wordpress’);

    The hostname of my server box is wordpress (I’m hosting it myself) and I’ve tried to change the host to localhost, but that doesn’t work either.

    I have a wordpress user set up for the wordpress database under MySQL, and I keep changing the password to make sure I’m not an idiot by misspelling it. I also say the allowed hosts are wordpress, and % (it says that this is all hosts)

    I’m totally missing what I’m doing wrong, will someone help me before I go insane doing the same things over and over and it still doesn’t work?

    Thanks.

    Edit: Ok, after playing around a bit more, I found out a few new things.

    Setting DB_HOST to localhost allows me to connect to the DB server when I have no password set in the config file. It doesn’t seem to matter if I have no password, or any password set for the user in the database itself.

    However, it says I cannot connect to the database, wordpress. It says to try <username>_<databasename> which I tried. It didn’t work, said it couldn’t find the database.

    When I have DB_HOST set to WordPress, I cannot connect to the MySQL server at all, for some reason.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry, this is not a WP issue. It’s about knowing how to set up your server. You’d be better off trying to get help at places that are specialized in setting up servers. We do not support personal server issues.

    You do want your DB_HOST set to ‘localhost’, especially incase your local name resolution for ‘wordpress’ isn’t working or you move machines etc etc.

    By <username>_<databasename> it may be referring to your actual login username (that created the database) and not the wordpress database username. (Lots of virtual hosting do mysql hosting using this format of Database Naming)

    What did you use to create the database?

    Ensure that you have only one record for the username you are connecting to the database as. I’ve seen situations before that there has been a username@localhost and a username@% and someone has been changing the password for one and not the other.

    I tend to recommend people use myPhpAdmin to do user management as it will show you more about what you want to know then what people tend to manually look for.

    I’m happy to offer you off-forum support, you can find my contact details on my website, listed in in my profile.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can’t Connect to MySQL DB’ is closed to new replies.