Can't connect to mysql?


#1

Hi,

I try to install piwik on my webserver, but in step 3, i have an error regarding database connexion.


PDO::__construct(): [2002] Connexion refusée (trying to connect via tcp://127.0.0.1:3306) 
in '/home/Username/www/piwik/libs/Zend/Db/Adapter/Pdo/Abstract.php' at the line 129

#0  Piwik_ErrorHandler(2, PDO::__construct(): [2002] Connexion refusée (trying to connect via tcp://127.0.0.1:3306), /home/Username/www/piwik/libs/Zend/Db/Adapter/Pdo/Abstract.php, 129, Array ([dsn] => mysql:host=127.0.0.1;dbname=Username_piwik;port=3306,[q] => ))
#1  PDO->__construct(mysql:host=127.0.0.1;dbname=Username_piwik;port=3306, Username, Password, Array ()) called at [/home/Username/www/piwik/libs/Zend/Db/Adapter/Pdo/Abstract.php:129]
#2  Zend_Db_Adapter_Pdo_Abstract->_connect() called at [/home/Username/www/piwik/libs/Zend/Db/Adapter/Pdo/Mysql.php:96]
#3  Zend_Db_Adapter_Pdo_Mysql->_connect() called at [/home/Username/www/piwik/core/Db/Adapter/Pdo/Mysql.php:31]
#4  Piwik_Db_Adapter_Pdo_Mysql->getConnection() called at [/home/Username/www/piwik/core/Db/Adapter.php:49]
#5  Piwik_Db_Adapter::factory(PDO_MYSQL, Array ([host] => 127.0.0.1,[username] => Username,[password] => Password,[dbname] => Username_piwik,[port] => 3306,[profiler] => 0)) called at [/home/Username/www/piwik/core/Piwik.php:1685]
#6  Piwik::createDatabaseObject(Array ([host] => 127.0.0.1,[username] => Username,[password] => Password,[dbname] => Username_piwik,[tables_prefix] => piwik_,[adapter] => PDO_MYSQL,[port] => 3306)) called at [/home/Username/www/piwik/plugins/Installation/Controller.php:196]
#7  Piwik_Installation_Controller->databaseSetup(The configuration file {/home/Username/www/piwik/config/config.ini.php} has not been found.) called at [/home/Username/www/piwik/plugins/Installation/Installation.php:72]
#8  Piwik_Installation->dispatch(Piwik_Event_Notification Object ([_notificationName] => FrontController.NoConfigurationFile,[_notificationObject] => Exception Object ([] => The configuration file {/home/Username/www/piwik/config/config.ini.php} has not been found.,[] => ,[] => 0,[] => /home/Username/www/piwik/core/Config.php,[] => 121,[] => Array ([0] => Array ([file] => /home/Username/www/piwik/core/Piwik.php,[line] => 1792,[function] => init,[class] => Piwik_Config,[type] => ->,[args] => Array ()),[1] => Array ([file] => /home/Username/www/piwik/core/FrontController.php,[line] => 202,[function] => createConfigObject,[class] => Piwik,[type] => ::,[args] => Array ()),[2] => Array ([file] => /home/Username/www/piwik/index.php,[line] => 59,[function] => init,[class] => Piwik_FrontController,[type] => ->,[args] => Array ())),[] => ),[_notificationInfo] => Array (),[_notificationState] => 0,[_notificationCount] => 0))
#9  call_user_func_array(Array ([0] => Piwik_Installation Object ([] => Piwik_Installation_Controller),[1] => dispatch), Array ([0] => Piwik_Event_Notification Object ([_notificationName] => FrontController.NoConfigurationFile,[_notificationObject] => Exception Object ([] => The configuration file {/home/Username/www/piwik/config/config.ini.php} has not been found.,[] => ,[] => 0,[] => /home/Username/www/piwik/core/Config.php,[] => 121,[] => Array ([0] => Array ([file] => /home/Username/www/piwik/core/Piwik.php,[line] => 1792,[function] => init,[class] => Piwik_Config,[type] => ->,[args] => Array ()),[1] => Array ([file] => /home/Username/www/piwik/core/FrontController.php,[line] => 202,[function] => createConfigObject,[class] => Piwik,[type] => ::,[args] => Array ()),[2] => Array ([file] => /home/Username/www/piwik/index.php,[line] => 59,[function] => init,[class] => Piwik_FrontController,[type] => ->,[args] => Array ())),[] => ),[_notificationInfo] => Array (),[_notificationState] => 0,[_notificationCount] => 0))) called at [/home/Username/www/piwik/libs/Event/Dispatcher.php:213]
#10 Event_Dispatcher->addObserver(Array ([0] => Piwik_Installation Object ([] => Piwik_Installation_Controller),[1] => dispatch), FrontController.NoConfigurationFile) called at [/home/Username/www/piwik/core/PluginsManager.php:390]
#11 Piwik_PluginsManager->addPluginObservers(Piwik_Installation Object ([] => Piwik_Installation_Controller)) called at [/home/Username/www/piwik/core/PluginsManager.php:278]
#12 Piwik_PluginsManager->reloadPlugins() called at [/home/Username/www/piwik/core/PluginsManager.php:182]
#13 Piwik_PluginsManager->loadPlugins(Array ([0] => CorePluginsAdmin,[1] => CoreAdminHome,[2] => CoreHome,[3] => Proxy,[4] => API,[5] => Widgetize,[6] => LanguagesManager,[7] => Actions,[8] => Dashboard,[9] => MultiSites,[10] => Referers,[11] => UserSettings,[12] => Goals,[13] => SEO,[14] => UserCountry,[15] => VisitsSummary,[16] => VisitFrequency,[17] => VisitTime,[18] => VisitorInterest,[19] => ExampleAPI,[20] => ExamplePlugin,[21] => ExampleRssWidget,[22] => ExampleFeedburner,[23] => Provider,[24] => Feedback,[25] => Login,[26] => UsersManager,[27] => SitesManager,[28] => Installation,[29] => CoreUpdater,[30] => PDFReports,[31] => UserCountryMap,[32] => Live)) called at [/home/Username/www/piwik/core/FrontController.php:209]
#14 Piwik_FrontController->init() called at [/home/Username/www/piwik/index.php:59]

If you can help,

Thanks.


#2

Mmh…

In fact, just replace 127.0.0.1 to localhost solve the problem