WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Error establishing a database connection (10 posts)

  1. udippel
    Member
    Posted 8 years ago #

    The topic is clear.

    This is what I have done so far:
    define('DB_NAME', 'uwedb'); // The name of the database
    define('DB_USER', 'root'); // Your MySQL username
    define('DB_PASSWORD', 'myPass'); // ...and password

    does not connect me.

    <html>
    <head>
    <title>PHP MySQL connection test</title>
    <body>
    <?php
    $connect = mysql_connect('localhost', 'root', 'myPass');
    // if no connect then die
    if (!connect) {
    die('something went wrong' .mysql_error());
    }
    echo 'It is time to enjoy your new OpenBSD Apache PHP MySQL powered web server.';
    // good form to close the connection
    mysql_close($connect);
    // close the php
    ?>
    </body>
    </html>

    does connect me.

    (Yes, I did a non-priviledged account as well, but the behaviour is the same:

    mysql -u udippel -p
    Enter password:
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 22 to server version: 4.0.23

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    , while the same parameters do not connect me on WordPress.

    What would be a reason for this ?

    (Of course, mysql shows up on the server as well:
    mysql
    MySQL Support enabled
    Active Persistent Links 0
    Active Links 0
    Client API version 4.0.23
    MYSQL_MODULE_TYPE external
    MYSQL_SOCKET /var/run/mysql/mysql.sock
    MYSQL_INCLUDE -I/usr/local/include/mysql
    MYSQL_LIBS -L/usr/local/lib -lmysqlclient

    Directive Local Value Master Value
    mysql.allow_persistent On On
    mysql.connect_timeout 60 60
    mysql.default_host no value no value
    mysql.default_password no value no value
    mysql.default_port no value no value
    mysql.default_socket no value no value
    mysql.default_user no value no value
    mysql.max_links Unlimited Unlimited
    mysql.max_persistent Unlimited Unlimited
    mysql.trace_mode Off Off)

    Any input welcome,

    Uwe

  2. Mark (podz)
    Support Maven
    Posted 8 years ago #

    Is the User associated to the database ?

  3. udippel
    Member
    Posted 8 years ago #

    I have no idea what you mean, sorry.
    Could you help me with a pointer ?

  4. Joshua Sigar
    Member
    Posted 8 years ago #

    Do you have the following in your wp-config.php? (You don't according to your first post)

    define('DB_HOST', 'localhost');

  5. Joshua Sigar
    Member
    Posted 8 years ago #

    Also, your second script does not show that you are able to select database uwedb

  6. udippel
    Member
    Posted 8 years ago #

    I simply didn't copy the 'define(...' because I had not changed it.

    W.r.t. selection: I don't know how to find out online, sorry.

    And w.r.t. the last link: this is exactly as I had created the database; using PhpMyAdmin.
    (So you can't argue php or mysql would not work)

    Still, wordpress is dead.

  7. udippel
    Member
    Posted 8 years ago #

    Got somewhat further:
    Though I followed the description, what I have is finally a user without password; and can connect, but not select.

    Strange, since I followed the description using PhPMyAdmin, and did it again, following "Using the MySQL Client".

    By now it looks like a mysql problem more than a wordpress problem; respectively a problem of the description how to create the user and the database; respectively my understanding of it.

    mysql> CREATE DATABASE uwedb;
    Query OK, 1 row affected (0.01 sec)

    mysql> GRANT ALL PRIVILEGES ON uwedb.* TO "udippel"@"hostname"
    -> IDENTIFIED BY "mypass";
    Query OK, 0 rows affected (0.01 sec)

    mysql> EXIT
    Bye

    This is where I can connect to; without password, and without selection:

    define('DB_NAME', 'uwedb'); // The name of the database
    define('DB_USER', 'udippel'); // Your MySQL username
    define('DB_PASSWORD', ''); // ...and password
    define('DB_HOST', 'localhost');

  8. udippel
    Member
    Posted 8 years ago #

    Thanks everyone; I'm done !

    I had two problems:
    One with the mysql-socket in OpenBSD's chroot-jail setup;
    then I could connect phpmyadmin.
    Still, the database problem could only be 'solved' by completely removing mysql-server and putting it back.
    Then the description created - as expected - the correct user parameters immediately.

    (I hate this as 'solution'; but in the end it was the only one).

    Thanks again,

    looking forward to start blogging ...

    Uwe

  9. Class
    Member
    Posted 8 years ago #

    I have seen MySQL fail to start several times under *BSD because the install doesn't assign the correct permissions to the db folders.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.