Cannot connect to MySQL server on 'localhost'.

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

Hi,

I have edited config.php file in c:\inetpub\wwwroot\cacti\include\config.php location to specify MySQL user, password and database.(Below are the changes);

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipw";
$database_port = "3306";
$database_ssl = false;

As I proceeded with the guidelines to ponit my web browser to http://localhost/cacti/ I encountered below error:

FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php' PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_oci8.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_oci8_11g.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_pdo_oci.dll' - The specified module could not be found. in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\ext\php_sybase_ct.dll' - The specified module could not be found. in Unknown on line 0 No log handling enabled - turning on stderr logging Cannot find module (IP-MIB): At line 0 in (none) Cannot find module (IF-MIB): At line 0 in (none) Cannot find module (TCP-MIB): At line 0 in (none) Cannot find module (UDP-MIB): At line 0 in (none) Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none) Cannot find module (SNMPv2-MIB): At line 0 in (none) Cannot find module (SNMPv2-SMI): At line 0 in (none) Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none) Cannot find module (UCD-SNMP-MIB): At line 0 in (none) Cannot find module (UCD-DEMO-MIB): At line 0 in (none) Cannot find module (SNMP-TARGET-MIB): At line 0 in (none) Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none) Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none) Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none) Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none) Cannot find module (UCD-DLMOD-MIB): At line 0 in (none) Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none) Cannot find module (SNMP-MPD-MIB): At line 0 in (none) Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none) Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none) Cannot find module (SNMPv2-TM): At line 0 in (none)


Currently I am looking to fix the connectivity failure to Mysql server later I can look into other errors.Please help we on how I can resolve this issue as I am new this setup.Please let me know if you need more info to help me out with this issue.

I did the setup in windows XP machine.

Regards,
Wasim
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cannot connect to MySQL server on 'localhost'.

Post by BSOD2600 »

1) is there a reason why you have all those extra extensions enabled in php? If you dont need it, disable it. Especially those throwing errors.
2) the mib errors are ignorable.
3) is mysql service running? are you able to login to it via the commandline?
Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Re: Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

Hi,

Yes,mysql server is running in my machine and I am able to login to it via command line.

Below are the s/w versions that are currently installed in my machine .


Operating System:Windows XP,SP3
Webserver:IIS 5.1
Cacti:0.8.8a
Spine:0.8.8a-win32
MySQL:5.5.24
PHP:5.3.13
RRDTool (Cygwin or Win32 build):1.2.15-cygwin-1.5.20
Net-SNMP:5.6.1.1
Cygwin (cygwin1.dll version):CYGWIN_NT-5.1 (DLL version 1.7.15)
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cannot connect to MySQL server on 'localhost'.

Post by BSOD2600 »

How did you install Cacti? It would appear the cacti user account in mysql needs to be recreated.
Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Re: Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

I have followed the steps provided in below URL to install Cacti.

http://bsod2600.home.comcast.net/~bsod2 ... ndows.html

The step says:

Recommended Install Path: C:\Inetpub\wwwroot\cacti\

Extract the cacti zip file to the root of your web server directory. This will be c:\inetpub\wwwroot if you are using the default installation of IIS. The extracted directory will be called cacti-0.8.7e. Rename it to cacti.

I also followed the steps to create cacti DB and its mysql username and password.

What you want me to do to resolve this issue?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cannot connect to MySQL server on 'localhost'.

Post by BSOD2600 »

Are you able to login to MySQL with the cacti credentials? If not, re-do the mysql user account creation steps.
Any errors in the mysql error log?
Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Re: Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

Yes,I am able to login to mysql 'cacti' DB using cacti credentials.

Below is the command I executed and was able to login using password created for cacti DB.

mysql -u cactiuser -p cacti

Do I need to try something else ? I don't see any error log,where can I see this ?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cannot connect to MySQL server on 'localhost'.

Post by BSOD2600 »

Wasim wrote:Yes,I am able to login to mysql 'cacti' DB using cacti credentials.
Put those credentials in config.php.
Wasim wrote:I don't see any error log,where can I see this ?
C:\Users\All Users\MySQL\<MySQL version>\data\<servername>.err
Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Re: Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

Those credentials are already copied to config.php file.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cannot connect to MySQL server on 'localhost'.

Post by BSOD2600 »

running: php -m at the command prompt still throw any errors? Ignoring the MIB related ones, they need to be fixed.
Restarted the server since making all the changes?
Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Re: Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

Below is the output of php -m command.Most of them are related to MIB,which according to you cna be ignored.Do you see any changes to be made to php.ini file based on this output to fix this issue?

No log handling enabled - turning on stderr logging
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (NET-SNMP-AGENT-MIB): At line 0 in (none)
Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)
[PHP Modules]
bcmath
bz2
calendar
com_dotnet
Core
ctype
curl
date
dom
enchant
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
json
ldap
libxml
mbstring
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SPL
SQLite
sqlite3
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Re: Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

Hi,

Could anyone please assist how I can move ahead now ? I am stuck here and not able to do any progress.
Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Re: Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

Hi,

Finally,I was able to install cacti.It worked after I changed user name to "root" and corresponding root "password".

But now I am not able to see the graphs getting generated.Any idea what could be the issue ?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Cannot connect to MySQL server on 'localhost'.

Post by BSOD2600 »

Wasim wrote:Finally,I was able to install cacti.It worked after I changed user name to "root" and corresponding root "password".
You should NOT be running cacti under the root account. big security hole.
Wasim wrote:But now I am not able to see the graphs getting generated.Any idea what could be the issue ?
read/followed http://forums.cacti.net/viewtopic.php?f=3&t=11747 yet?
Wasim
Posts: 27
Joined: Thu May 31, 2012 6:48 am

Re: Cannot connect to MySQL server on 'localhost'.

Post by Wasim »

As the cacti is already installed,what I need to do in order to run it under another user account?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests