mckm Posted February 12, 2015 Share Posted February 12, 2015 (edited) I installed PrestaShop (Version 1.6.0.11) using "Softaculous" from my hosting company, everything went fine while installing but got error when accessing my site. I am getting error as below when I access my site http://mck.x10.mx/prestashop/ Link to database cannot be established: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) My config/settings.inc.php has following settings (actual values changed) define('_DB_SERVER_', 'localhost'); define('_DB_NAME_', 'mydbname'); define('_DB_USER_', 'mydbuser'); define('_DB_PASSWD_', 'mydbpassword'); define('_DB_PREFIX_', 'ps_'); define('_MYSQL_ENGINE_', 'InnoDB'); NOTE: I also have wordpress site and it is working with similar credentials, so I know the database is working. The wordpress site settings are /** The name of the database for WordPress */ define('DB_NAME', 'mydbname'); /** MySQL database username */ define('DB_USER', 'mydbuser'); /** MySQL database password */ define('DB_PASSWORD', 'mydbpassword'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', ''); /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each a unique * prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wp_'; Edited February 12, 2015 by mckm (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted February 12, 2015 Share Posted February 12, 2015 I think the socket should be at /var/run/mysqld/mysqld.sock, not /tmp/mysql.sock. Link to comment Share on other sites More sharing options...
mckm Posted February 12, 2015 Author Share Posted February 12, 2015 (edited) I think the socket should be at /var/run/mysqld/mysqld.sock, not /tmp/mysql.sock. What do I need to change? Where do I change it? and I do not think it will work if it is using raw sockets or something since my Hosting company may not allow it. Edited February 12, 2015 by mckm (see edit history) Link to comment Share on other sites More sharing options...
mckm Posted February 12, 2015 Author Share Posted February 12, 2015 (edited) Finally I solved it myself. 1) Deleted the file in <prestashopdir>/config/settings.inc.php 2) Downloaded prestashop_1.6.0.11.zip 3) Unzippped the doenloadef zip file on my local system 4) Zipped up all the folder install/* into install.zip file (making sure the zip file contained the install directory itself in the root) 5) FTP the install.zip file to my web server to <prestashopdir> and unzipped the zip file which created the install directory. 6) Launched the install app from my server using http://mck.x10.mx/prestashop/install 7) followed the steps till Database configuration menu. 8) Filled in all the db server parameters and set Database Server=127.0.0.1 (instead of "localhost") 9) Test connection : SUCCESS 10) Continued with database table created trough the install app. 11) deleted the install folder as displayed. Edited February 13, 2015 by mckm (see edit history) Link to comment Share on other sites More sharing options...
mayanavi Posted August 29, 2016 Share Posted August 29, 2016 Greetings . My store genre me the same error. However , solve it by changing the 'localhost' the setting.inc.php by ' 127.0.0.1 ' . I hope the information is useful. 1 Link to comment Share on other sites More sharing options...
schenbr1 Posted June 22, 2017 Share Posted June 22, 2017 Greetings . My store genre me the same error. However , solve it by changing the 'localhost' the setting.inc.php by ' 127.0.0.1 ' . I hope the information is useful. This worked for me. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now