Hi,
I had some working websites including my main website http://www.itsmfi.org which were originally on a Shared Linux Server at 1&1 Internet. Due to traffic building up I was requested to upgrade to a Managed Server, which happened over the weekend.
My issues are that I need to export and re-import my SQL databases from the Shared Servers to my own Servers (I have some notes and plan to do this later this week).
At the moment my website http://www.itsmfi.org doesn't display properly and I&1 have informed me that "To access your MySQL 5 database using your own scripts, you must include the socket (/tmp/mysql5.sock) of your MySQL 5 database in your scripts."
They gave some sample code:
$hostname="localhost:/tmp/mysql5.sock";
$database="dbxxxxxxxxx";
$username="dboxxxxxxxxx";
$password="********";
$link = mysql_connect("$hostname", "$username", "$password", "$database");
if (!$link) {
die('connection failed: ' . mysql_error());
}
echo 'connection established successfully';
mysql_close($link);
So my question is where I include this (which files) and what parameters is Drupal expecting so my websites display properly.
Thanks
Chris
Comments
just guess ... see if u can
just guess ...
see if u can find the tmp/mysql5.sock file.
see if the file contains a port number for your sql5.
if yes, manually copy the port number to your script.
say ...$hostname="localhost:12345"; <--add the port number
Problem Fixed
My ISP 1and1 had moved me over to a Managed Server with both used a non-standard port as well as required the connection to the mysql5 socket.
So here is what fixed my issue
I added to php.ini the line:
mysql.default_socket = /tmp/mysql5.sock
I added into the settings.php the line
$base_url = 'http://www.itsmfi.org:3136';
Another Solution That Works
As an alternative to modifying php.ini, you can make the change in Drupal's settings.php file.
A typical line in the settings file looks similar to this:
$db_url = 'mysql://username:password@localhost/databasename';
The line for MySQL 5 on a 1and1 managed server looks like this:
$db_url = 'mysql://username:password@localhost%3A%2Ftmp%2Fmysql5.sock/databasename';
Don't change the '%3A' and '%2F' to ':' and '/' characters. They need to be encoded for Drupal to use them correctly.
Also, remember to substitute the correct username, password, and databasename (which you can copy from the MySQL Databases section of the 1and1 control panel).
(I was able to figure this out from the posts by ksuquix and jrwjrw in http://drupal.org/node/7620.)
JM
Thanks a lot. This was an
Thanks a lot. This was an extremely oblivious solution for me. I should have figured it out myself. It's such a simple solution! :)
---
I have created and maintained countless Drupal-powered sites and have made heavy modifications to modules on a site-by-site basis. I am an illustrator, a game developer, and a web developer. I also stream on Twitch in my spare time.
Thanks
Thanks for posting this, just come off the phone to 1and1 asking about this mysql5.sock stuff and installing drupal.
They went away scratching their head whilst I was left cursing.
A quick search here though and you people come up with the goods, superb stuff... thanks again.
Keith
Yeah, 1and1 support isn't all
Yeah, 1and1 support isn't all that knowledgeable about Drupal. ;)
This is a solution we should have figured out on our own, though.
---
I have created and maintained countless Drupal-powered sites and have made heavy modifications to modules on a site-by-site basis. I am an illustrator, a game developer, and a web developer. I also stream on Twitch in my spare time.