• Hi guys. I’m having a hell of a time getting WordPress operational on my local webserver, which is the default Apache 2 install that comes on Mac OS 10.5.

    Apache & PHP work, but I am having a problem configuring it to use Mysql. Mysql actually works right now. Using Webmin, I have created a user for wordpress and a database for wordpress and assigned the appropriate permissions so that wpuser can do anything at all to wordpress the database.

    I think the problem is that the installation of mysql is ‘nonstandard’ in the sense that it was installed using MacPorts, and is therefore present at /opt/local/bin/mysql5. I doubt that /opt/local/bin is in the $PATH of wpuser and I also doubt that WP will know to use mysql5 instead of mysql. Unfortunately I don’t see a way to configure this – so here I am.

    Here are a few things that I think *are* correctly configured:
    1. DB _NAME, _USER, and _PASSWORD : These were configured with a gui and therefore hard to mess up.
    2. DB_HOST: webmin has no problems connecting to ‘localhost’ or ‘127.0.0.1’ on the default port and socket, so I doubt that this is the issue.
    3. I’ve got the main mysql5 executable symlinked to /bin/mysql and /usr/bin/mysql and still no luck.

    AFAICT, that only leaves the weird path as the culprit, but I’m probably missing something huge.

    Thanks in advance for any suggestions.

Viewing 5 replies - 1 through 5 (of 5 total)
  • you dont say whats happening? whats happening when you use those results?

    Thread Starter masonk

    (@masonk)

    By the way, I’ve read a few blog posts about the socket being in the wrong place. Both say to update /etc/php.ini with the correct default mysql socket.

    https://foolswisdom.com/mac-wordpress-error-establishing-a-database-connection/

    https://www.fischerlaender.net/apple-mac/mac-os-x-trouble-with-mamp-mysql

    However, my socket is at neither of those places. I think it’s here: /opt/local/var/run/mysql5/mysqld.sock. However, updating the php.ini file with that location (e.g. localhost:/opt/local/var/run/mysql5/mysqld.sock) doesn’t seem to fix the problem either.

    Thread Starter masonk

    (@masonk)

    Ahh, yes, I’m getting the “Error establishing a database connection” screen when I navigate to the wordpress site.

    Thread Starter masonk

    (@masonk)

    I got it to work. I created a new .php file to test the command mysql_connect().

    What worked was using ” (emptry string as the DB_HOST).
    define('DB_HOST', '');

    and having my php.ini line read:
    mysql.default_socket = localhost:/opt/local/var/run/mysql5/mysqld.sock

    I know this is an old thread, but there is an easier way.

    Change the default:
    define('DB_HOST', 'localhost');

    To:
    define('DB_HOST', 'localhost:/tmp/mysql.sock');

    If you socket is in a non-standard location, change the “/tmp/mysql.sock” to your socket path, just don’t forget the colon between “localhost” and the path.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Getting WordPress to work with non-standard mysql install in Mac OS 10.5’ is closed to new replies.