spring00 Posted May 2, 2013 Share Posted May 2, 2013 (edited) Hi I've been trying to make a copy of my prestashop 1.5.3 onto a different host (Bluehost). I am now getting this error message: Fatal error: Uncaught Link to database cannot be established: SQLSTATE[42000] [1044] It says access is denied for the user. Basically what I did was to make a local copy of my shop, then ftp it to the new webspace. I created a new database in phpMyAdmin and imported my original database. I set up a new user for the database too. I updated the settings.inc.php to reflect the new database and user details. I also updated the ps_shop_domain and ps_configuration tables for the new domain. I thought I was doing well! lol! But now I cant get past this error. Have I missed something out? Is there anything else I need to do? By the way I didnt copy the .htaccess file across. Was this a mistake? Edited May 3, 2013 by jen00 (see edit history) Link to comment Share on other sites More sharing options...
prestashopninja Posted May 3, 2013 Share Posted May 3, 2013 Please check two more things: 1. Does the MySQL user have proper rights on your PS database? 2. The file permissions for settings.inc.php You could also check your MySQL connection with a simple code snippet as follows: <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "my_database"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } /* return name of current default database */ if ($result = $mysqli->query("SELECT DATABASE()")) { $row = $result->fetch_row(); printf("Default database is %s.\n", $row[0]); $result->close(); } /* change db to world db */ $mysqli->select_db("world"); /* return name of current default database */ if ($result = $mysqli->query("SELECT DATABASE()")) { $row = $result->fetch_row(); printf("Default database is %s.\n", $row[0]); $result->close(); } $mysqli->close(); 1 Link to comment Share on other sites More sharing options...
spring00 Posted May 3, 2013 Author Share Posted May 3, 2013 Thanks so much for your reply! For the settings.inc.php I have only changed the following:- define('_DB_SERVER_', 'localhost'); define('_DB_NAME_', 'xxxx'); define('_DB_USER_', xxxx'); define('_DB_PASSWD_', 'xxxx); Is there anything else I need to change in that file? How do I use the code snippet to check the MySQL connection? Link to comment Share on other sites More sharing options...
prestashopninja Posted May 3, 2013 Share Posted May 3, 2013 (edited) Hi, Regarding the settings file: This should be enough. To use the test code, create an empty text file and name it "testdb.php". Copy the code above into it and edit $mysqli = new mysqli("localhost", "my_user", "my_password", "my_database"); to fit your database settings. Then, upload it onto your Prestashop Installation's home dir and call it from your browser as http://yourprestasho....com/testdb.php Edited May 3, 2013 by prestashopninja (see edit history) Link to comment Share on other sites More sharing options...
spring00 Posted May 3, 2013 Author Share Posted May 3, 2013 (edited) Just to give an update - its sorted Many thanks to prestashopninja. I was not used to my new host company's mysql user settings. So I double checked and realised that I had to link my database user to the database. This has solved the problem. Edited May 3, 2013 by jen00 (see edit history) Link to comment Share on other sites More sharing options...
spring00 Posted May 3, 2013 Author Share Posted May 3, 2013 Oh heck. I spoke too soon Now I can see the new website so the database seems to be working. But it doesnt look right even though I copied the theme as well as everything else. None of the images are showing and none of the links work. Can anyone help please? Link to comment Share on other sites More sharing options...
prestashopninja Posted May 3, 2013 Share Posted May 3, 2013 Could you give the link so we could have a look into it? Link to comment Share on other sites More sharing options...
spring00 Posted May 3, 2013 Author Share Posted May 3, 2013 (edited) I've realised that I havent actually managed to copy any of the products over despite trying to export and import the database. I dont know what I've done wrong Is there an easy way to export products from 1.5.3.1 so that they can be imported into another 1.5.3.1 shop? Edited May 3, 2013 by jen00 (see edit history) Link to comment Share on other sites More sharing options...
Optimus_Sam Posted March 17, 2014 Share Posted March 17, 2014 Thanks PS ninja! Link to comment Share on other sites More sharing options...
Recommended Posts