PDA

View Full Version : Can't Connect To Database Today


RustyACE2
1-27-04, 09:57 AM
Dear Fellow PHP users:

I'm getting the following error message on my bulletin board this morning (after working flawlessly for the past year):

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I've checked OPS and there aren't any apparent outages.

I've checked the threads and there doesn't seem to be any common thread yet.

I've checked my PHPAdmin and the data appears intact and there, I just can't seem to reach it this morning.

Has any configuration been changed lately?

Any Ideas?

I'm using XMB 1.8 Bulletin Board Software which up until today hasn't even burped over the past year.

Thanks for your help in advance,

Rusty

NMS
1-27-04, 10:04 AM
On which mysql server are you? I would recommend that you contact admin@powweb.com .. maybe they can help you out.

RustyACE2
1-27-04, 10:06 AM
jupiter.powweb.com

NMS
1-27-04, 10:13 AM
That is not the MySQL server .. you have to check within the OPS under Packages > MySQL tab

RustyACE2
1-27-04, 10:14 AM
Your mySQL database xxxxxxxxxxxxx is hosted on PowWeb's server jupiter.powweb.com run mysqld version 4.0.15-log. Your database users and privileges are shown below. All changes are made in real time.

tbonekkt
1-27-04, 10:16 AM
Check your config - are you using 'localhost'? I don't believe that was a long-term solution. You should use 'jupiter.powweb.com' instead.

NMS
1-27-04, 10:19 AM
Must be an old database .. jupiter is up and running normally so it must be something within the connection settings

RustyACE2
1-27-04, 10:22 AM
That fixed it.

Now, while I was fixing that I noticed that my config file has the name and password clearly displayed in the file.

Is there anyway to get around that.

I would really rather have it call a password and user id from above the htdocs level.

Is this possible and is it a reasonably easy fix or even suggested?

Rusty

RustyACE2
1-27-04, 10:25 AM
<?php
/*

XMB 1.8 Partagium
© 2001 - 2002 Aventure Media & The XMB Developement Team
http://www.aventure-media.co.uk
http://www.xmbforum.com

For license information, please read the license file which came with this edition of XMB

*/

// Database connection settings
$dbname = 'xxxxxxxxxxxxx'; // Name of your database
$dbuser = 'xxxxxxx'; // Username used to access it
$dbpw = 'xxxxxxxxxx'; // Password used to access it
$dbhost = 'jupiter.powweb.com'; // Database host, usually 'localhost'
$database = 'mysql'; // Database type, currently only mysql is supported.
$pconnect = 0; // Persistent connection, 1 = on, 0 = off, use if 'too many connections'-errors appear

// Table Settings
$tablepre = 'xmb_'; // Table-pre

// Cookie-settings
$cookiepath = '/forum'; // The path to your board, eg: IF IT IS: http://your-domain/forum/index.php, YOUR COOKIEPATH WILL BE: '/forum'
$cookiedomain = '.xxxxxxx.com';// The domain this forum is on, eg: IF IT IS: http://your-domain/forum/index.php, COOKIEDOMAIN WILL BE: 'your-domain'

// Plugin Settings
$plugname[1] = ''; // Added plugin name, to create another plugin, copy and change [1] to [2] etc
$plugurl[1] = ''; // This is the location, link, or URL to the plugin
$plugadmin[1] = 'no'; // Is this plugin only for admins? Set to yes for admins, no for public

// Registration settings
/*
* Registrations from the same IP to happen more than once per 24 hours,
* To allow
* turn the following option 'off'. Meaning instead of the default:
* $ipreg = 'on';
*
* change it to:
* $ipreg = 'off';
*/

$ipreg = 'on';
?>

tbonekkt
1-27-04, 10:27 AM
Glad it's working again for you. :)

Sure you could. Create a new PHP file (name it whatever you wish), define your username/password variables there. Upload at root-level (same level as htdocs). Then in any other PHP page you need that info, include the following:<?php require("/www/u/username/file.php"); ?>

NMS
1-27-04, 10:28 AM
It is possible for phpadmin by using a cookie system (latest version .. you may need to update). No idea about XMB .. check on their website .. maybe their forum.

RustyACE2
1-27-04, 10:30 AM
Thanks.

Everyone that has helped just saved me a day of headaches trying to deal back and forth with PW.

I'll definitely implement the above fix and If I run into more problems I'll let you know.

Rusty

tbonekkt
1-27-04, 10:31 AM
Also, you should CHMOD any php files that contain sensitive information to 600.

RustyACE2
1-27-04, 10:32 AM
I have a vague understanding of chmod.

I've got a script that I'll modify.

My ? is, what is the difference between 444, 600 and all of the other numbers?

Thanks,
Rusty

tbonekkt
1-27-04, 10:35 AM
It has to do with who has access to files on the server. See this tutorial for a helper: http://help.powweb.com/tutorials/ftp/chmod.php

600 would give only the owner read/write access. So if someone knew how to view your files on the server (not over the internet), a CHMOD of 600 would prevent them from being able to view the file UNLESS they used your password to gain access.

metto
1-27-04, 07:31 PM
Originally posted by tbonekkt
Glad it's working again for you. :)

Sure you could. Create a new PHP file (name it whatever you wish), define your username/password variables there. Upload at root-level (same level as htdocs). Then in any other PHP page you need that info, include the following:<?php require("/www/u/username/file.php"); ?>

You wouldn't happen to have that in Perl/CGI?

Thanks,

Amr