Error while trying to connect to the database server:SQLSTATE[HY000] [2002] Connection refused

Hi Experts,

		I am trying to install Piwik in my environment. All pre-requisite packages are installed and the system check was success as well.
		I was guided to next step which is database setup.Eventhough my db is up my piwik database test is unsuccessfull. I am getting the below error.any idea how to fix the issue
		
		Error
		
		Error while trying to connect to the database server: 
        SQLSTATE[HY000] [2002] Connection refused
		
		Database Server	: localhost
		
		 /etc/init.d/mysqld status
  		mysqld (pid 25320) is running...


          
	150627  8:43:16  InnoDB: Started; log sequence number 0 43655
	150627  8:43:16 [Note] /usr/libexec/mysqld: ready for connections.
	Version: '5.0.95'  socket: '/opt/mysql/mysql.sock'  port: 3306  Source distribution

	(Not all processes could be identified, non-owned process info
	will not be shown, you would have to be root to see it all.)
	tcp        0      0 127.0.0.1:3306              0.0.0.0:*                   LISTEN      25320/mysqld

	
	 Piwik version 2.13.0
	 
	 cat /etc/my.cnf

[mysqld]
datadir=/opt/mysql
socket=/opt/mysql/mysql.sock
bind-address=localhost
user=mysql

Hi

1- Version: '5.0.95 ? Whats wrong with 5.6.x ?
2- are you trying to acess local (DB in same machine as Piwik or remotely) ?
3- See if everything is OK with you users,
select user,host,char_length(password) from mysql.user
4- Crosscheck the latest info with what you’ve stated in (config.ini.php)
5- Using the info in the config.ini.php try to
mysql -h [hostname] -u [username] -p[password] -D [dbname]
6- at this time comment
#bind-address=localhost

Regards,
J. Meirim

We have published a FAQ about the error “Connection refused”, here it is: How do I fix the Mysql error “Connection refused”?

Hope it helps