• We have a RHEL3 server with three mysql instances, 3.23.58 (port 3306), 4.1.22 (port 3307), and 5.0.45 (port 3308). The latter two instances are add-ons while the first (3.23.58) is the system default with binaries and libraries installed in /usr/bin and /usr/lib. The WP database is installed in the 4.1.22 instance and DB_HOST in wp-config.php points to “localhost:3307”. With this configuration, we get an “unable to connect to database” error. When I add “include(‘connect.php’); echo mysql_get_server_info();” to index.php, it reports that the database version is 3.23.58. I’m concluding that the apache/php/wordpress is attempting to reach the 4.1.22 instance with 3.23.58 and therefore the error. Can anyone provide any advice on how to tell the specific wordpress/php instance to use a custom configured LD_LIBRARY_PATH and PATH so that it will use the 4.1.22 programs (/usr/local/mysql_4.1.22/bin) and libraries (/usr/local/mysql_4.1.22/lib) without changing the apache server defaults? Or is this not possible?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Maybe define('DB_HOST', 'mysql.example.com:3307') from MySQL_Alternate_Port Editing wp-config.php « WordPress Codex? Maybe you won’t need custom library paths.

    Thread Starter reolf

    (@reolf)

    Tried various forms of DB_HOST with no luck. Changing DB_HOST doesn’t change the underlying fact that the connection to mysql4 is being made using mysql3 libraries. Not advisable and very likely the cause of the “Error establishing a database connection” result. The obvious fix is to change the PATH and LD_LIBRARY_PATH of the httpd server so PHP and WP can inherit the correct settings but this will likely adversely affect other applications running on this server, so no can do. I’m grasping at straws at this point in hopes that some very seasoned WP guru will have some way of having just the WP PHP use different libraries than the host httpd.

    I’ll admit I’m no WP guru! Can you run another instance of apache? Server Fault is a good place for in depth questions.

    I bet a LOT of people are going to want to do this, now that WP 2.9 just went live and broke a bunch of sites that are on versions of MySQL lower than 4.1.22. Me, for example.

    reolf, did you ever figure out how to do this? You’ll be a hero to many if you can describe what you did. 🙂

    Reolf is administering his own server, so he is and can run mulitple instances of MySQL and Apache. If you’re running your own server or hosted virtual server, you should be able, too: Questions containing ‘[mysql] multiple’ – Server Fault

    But just about every shared hosting – or average hosting setup for wordpress users in these forums – is not going to let you run non-standard instances, or anything more than the MySQL instance the host gives you. If you’re having trouble with a host running 4.1.22 and wordpress 2.9 – which is a fairly common question now with the release of 2.9 – ask them about upgrading. You may be able to upgrade within your own hosting control panel with little effort.

    Hm. I forgot to circle back on this one. I wrote up a pretty extensive description of how I wound up solving this problem. Click HERE to read the post — for those of you who are still wrestling with the “old mySQL database” problem.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Pointing WordPress to non-standard MySQL instance’ is closed to new replies.