• Resolved udippel

    (@udippel)


    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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Is the User associated to the database ?

    Thread Starter udippel

    (@udippel)

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

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

    define('DB_HOST', 'localhost');

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

    Moderator James Huff

    (@macmanx)

    Thread Starter udippel

    (@udippel)

    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.

    Thread Starter udippel

    (@udippel)

    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’);

    Thread Starter udippel

    (@udippel)

    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

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

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