[Solved] Can't connect to local MySQL server ...

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
Evil Phil
Forum Members
Forum Members
Posts: 23
Joined: Fri May 09, 2008 10:36 am

[Solved] Can't connect to local MySQL server ...

Post by Evil Phil »

Hello,

So the background is I've moved from my dev box to a hosting server. Details on the hosting server are:
CMS Made Simple Version 1.2.3.
PHP Version 4.4.7
Apache/1.3.37 (Unix)
MySql Version 4.1.15

Dev box details are in my sig if anybody should want them.


I've followed the moving server steps in the wiki to a T. Now when I visit the site I get the following error:
Database Connection Failed
Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) (2002)
Function Performed: CONNECT
Host/DB: localhost/ dbname
Database Type: mysql

I've copied up the install folder to see if that would work and it does but fails at the db step, returning error message: Could not connect to the database. Verify that username and password are correct, and that the user has access to the given database.

PHP is working as I've included a test.php file to return phpinfo() at the root and it works fine. I'm coming from Windows so the *nix stuff is all new to me. Anybody got any suggestions as to how I should troubleshoot this problem?

thanks in advance.
Last edited by Evil Phil on Thu Aug 21, 2008 12:07 pm, edited 1 time in total.
CMS Made Simple 1.4.1, PHP Version 5.2.5, MySql 5.0.45, Apache 2.2.26 on WAMP5 (Windows XP Pro)
Nick Smart
Forum Members
Forum Members
Posts: 116
Joined: Mon Jul 28, 2008 4:48 pm

Re: Error: Can't connect to local MySQL server ...

Post by Nick Smart »

Have you correctly updated all the database name, username and password details and all the URLs in your config.php?

Nick
Evil Phil
Forum Members
Forum Members
Posts: 23
Joined: Fri May 09, 2008 10:36 am

Re: Error: Can't connect to local MySQL server ...

Post by Evil Phil »

Yeah, sorry I should have said that. They are all correct - I'm using 'localhost' for $config['db_hostname'], there is a MySql URL coming from the host too but if I use that then I just get a blank page with no error, not my homepage.
CMS Made Simple 1.4.1, PHP Version 5.2.5, MySql 5.0.45, Apache 2.2.26 on WAMP5 (Windows XP Pro)
Nick Smart
Forum Members
Forum Members
Posts: 116
Joined: Mon Jul 28, 2008 4:48 pm

Re: Error: Can't connect to local MySQL server ...

Post by Nick Smart »

Have you specified the database name and username correctly, e.g. if your hosting account is "evil" and you create a database called "cms" the database name is usually "evil_cms" and the username is likley to be "evil_myuser".

Also, try creating a simple php program to check you can connect to the db, nothing to do with cmcms, e.g.:

Code: Select all

<?php
$connect = mysql_connect( "localhost", "evil_myuser", "very-secret" );
@mysql_select_db( "evil_cms", $connect ) or die( "ERROR: Unable to connect to the database" );
echo "<p>It worked!</p>";
?>
(all code untested).

Nick
Evil Phil
Forum Members
Forum Members
Posts: 23
Joined: Fri May 09, 2008 10:36 am

Re: Error: Can't connect to local MySQL server ...

Post by Evil Phil »

Okay then progress has been made. I've ran you're little php page and changed from localhost to the address of the mysql box and that worked. Problem is now I'm getting an empty document served when I go to the homepage or the admin page.

But I suppose that's a different problem, I'll flag this one as solved. However if you've any ideas as to why its blank or how to trouble shoot that I'd be most grateful :D

Thanks Nick, you should get a karma+1 for that.
CMS Made Simple 1.4.1, PHP Version 5.2.5, MySql 5.0.45, Apache 2.2.26 on WAMP5 (Windows XP Pro)
Locked

Return to “[locked] Installation, Setup and Upgrade”