2

I have followed the relatively simple steps to migrating a Magento 2 site from my localhost to a live server. When I type in my new URL to see the site, I get an error screen with a message directing me to an error log.

From inside the error log I see the following error message:

a:4:{i:0;s:48:"SQLSTATE[HY000] [2002] No such file or directory";i:1;s:3133:"#0 /homepages/25/d336955856/htdocs/mfg_oldSite/product-catalog/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()

I am not able to access either the regular public pages because of this error. I also get a 404 error when trying to access the admin page.

Any ideas? Any further info needed to make my question clear?

amphetamachine
  • 27,620
  • 12
  • 60
  • 72
as_whitley
  • 25
  • 4
  • please check for `Mysql.php` it might be lost during migration . – urfusion Oct 21 '15 at 19:14
  • Thanks @urfusion . I checked, and mysql.php is in place. – as_whitley Oct 21 '15 at 19:18
  • have you clear `cache`, `session` and `log table`? – urfusion Oct 21 '15 at 19:20
  • I cleared the cache but did not see to clear session or log table in the instructions I was using. When clearing the other two am I deleting all the contents of both /session and /log? Is that what you are meaning for me to do? – as_whitley Oct 21 '15 at 19:26
  • yes clear sessions too and there are a few table name as `log_url` and similar. clear them too – urfusion Oct 21 '15 at 19:29
  • I cleared those as well but am still getting the same error message in the newest created error log. – as_whitley Oct 21 '15 at 19:34
  • on local you are working on window system or linux? – urfusion Oct 21 '15 at 19:35
  • some time this error occur due to file permission. try to set permission of files and folders. check this http://urfusion.net/set-permission-for-magento-magento-cleaning/ – urfusion Oct 21 '15 at 19:40
  • On local I am working in a Mac, so it is similar to Linux. I will check the permissions now. – as_whitley Oct 21 '15 at 19:47
  • @urfusion I did the permission cleaning. Still no change in the error message. – as_whitley Oct 21 '15 at 20:16
  • have you change configuration in `/app/etc/local.xml` ? it might be due to you are not able to connect to DB . check for `hostname` and `DB` and `username` and `password`. – urfusion Oct 21 '15 at 20:20
  • I did change the configuration. I am leaving to go home right now, but I will revisit this in the morning. I will triple check the config settings and see if anything I do there will help. – as_whitley Oct 21 '15 at 20:26
  • Have you checked http://stackoverflow.com/questions/2412009/starting-with-zend-tutorial-zend-db-adapter-throws-exception-sqlstatehy000 ? – adrien54 Oct 26 '15 at 10:04
  • I had a similar issue and changing the host within my `app/etc/local.xml` fixed this issue, I had to change it like so: `<![CDATA[/tmp/mysql.sock]]>` Also, another thing to look for is if your table has a prefix that it matches the same prefix in the local.xml file. – Karl Oct 27 '15 at 15:54
  • Have you tried my comment above? – Karl Oct 30 '15 at 10:52

3 Answers3

1

Check your host setting in /app/etc/local.xml

Try with changing it from "localhost" to "your server host"

have a look PDOException SQLSTATE[HY000] [2002] No such file or directory

EDIT

As per the whole discussion we have done. I am assuming that you have wrong credentials. this is why you are not able to connect to your DB.

Community
  • 1
  • 1
urfusion
  • 5,528
  • 5
  • 50
  • 87
  • thanks for the continued help. I did already have the host set to the host from the hosting server's database setup. But still no go. – as_whitley Oct 22 '15 at 11:29
  • if you have right credentials and still not able to connect then try these credentials on local which is working. if it connect then we should do further research otherwise there is the problem in these credentials. – urfusion Oct 22 '15 at 12:18
  • I am not sure how to use the same credentials on localhost. It is setup as username: root password: root and the host as: localhost. Not sure how to use the new username, password, and host address from the live server in my localhost setup. – as_whitley Oct 22 '15 at 12:30
  • open `/app/etc/local.xml` and change the settings with the live details. – urfusion Oct 22 '15 at 12:39
  • My question is that I am not sure how to make credentials created for my live server work on a localhost server that is set up with totally different credentials. Since the live server credentials are completely different they would break my connection to my localhost. What am I not understanding about your suggestion? – as_whitley Oct 22 '15 at 13:26
  • Yes, they break. But they told us about the problem. Is problem in your code or ita just a wrong credentials issue. – urfusion Oct 22 '15 at 13:28
  • Keep a copy of your local.XML for seafty. – urfusion Oct 22 '15 at 13:29
  • I am sorry @urfusion. I truly don't understand what you want me to do. It doesn't make sense to me. My local Magento setup on my Mac is setup to use a database created in my local MAMP mySql and uses a username of root, and password of root, and a host of "localhost" to connect to Magento to that local database on my computer. You are wanting me to use my live server credentials that I created at my hosting provider in my localhost setup on my personal computer? That would not connect so I am not sure what we are trying to do here. Sorry for my confusion. – as_whitley Oct 22 '15 at 13:41
  • I am just asking you to connect your local project to live DB. and we can connect local to live if our internet is working. And I am saying this because as you say Magento 2 is working on you local machine it means there is no issue with the code, the only thing left is the credentials that might be wrong. So if you try to connect you local to live DB if it got connected there is something else we are missing and if not connected then we found our problem i.e `credentials` . got my point ? – urfusion Oct 22 '15 at 13:47
  • if you confuse in how to connect local to live then follow simple steps. create a copy your local project local.xml and then replace your loca project local.xml by live project local.xml. do testing and when you done just replace original copy of local.xml(of your local project) – urfusion Oct 22 '15 at 13:54
  • I understand now. You are asking me to change the config info in my localhost setup to point to the database that I created at the online host. I will try that now. – as_whitley Oct 22 '15 at 13:56
  • I updated the local.xml file with the connection information from my online database setup. It does not go through. I get an ERR_CONNECTION_REFUSED Webpage not available message. Not sure what to do to fix this since I know that the config info is correct from the online database. I have checked about 20 times. Thanks for your help! – as_whitley Oct 22 '15 at 14:06
  • what is the host name you are passing? is it localhost? on live. – urfusion Oct 22 '15 at 15:29
  • No. I used the host name from the live server database and inserted that in place of "localhost". – as_whitley Oct 22 '15 at 15:35
  • create a normal core php file with DB connection and check that on the server. is that work or not? – urfusion Oct 22 '15 at 15:45
  • Sorry. Not sure what you are asking me to do now. What do you mean by normal core php file with DB connection? And is this another instance of doing something on my local machine and pointing it to the remote server? Thanks – as_whitley Oct 22 '15 at 16:45
  • I hope I did not cause a problem by not knowing the answer to my last question to you. I am just not sure what you mean, or better yet, which file you mean, when you say normal core php file. Sorry. – as_whitley Oct 23 '15 at 17:45
  • without checking the credentials I not able to do any help. Because According to me it just a problem of wrong credentials. BTW you try to ask your question on magento exchange http://magento.stackexchange.com/. this site is purely for magento users. your question will get more attention and you got more suggestions. I already raise a flag to moderators of SO to move your question yo Magento Exchange but didn't know how much time they will take. So if you go by yourself it is much faster. – urfusion Oct 23 '15 at 18:25
  • Sorry about posting my question in the wrong place. I do not know how to move it to another area myself, but I will try to figure it out. Thanks for your help and suggestions. – as_whitley Oct 23 '15 at 19:05
  • this also a right place to ask your question. but in your question you need more support ,I think :-) . No need to delete it from here. you can ask another to magneto exchange . – urfusion Oct 23 '15 at 19:06
  • and one more thing you should learn about SO. make some edits in question if is it not answered. it help you question to get attraction. Like one I made a time before by editing your tags – urfusion Oct 23 '15 at 19:08
  • I am awarding bounty on your question to get more attention – urfusion Oct 23 '15 at 19:10
  • Thanks on all @urfusion! – as_whitley Oct 23 '15 at 19:43
  • Welcome. I also excited about the issue. – urfusion Oct 23 '15 at 20:13
  • @as_whitley : default port number for mysql is `3306`. check with your hosting provider for open of this port. and ask him that which mysql version is on server? – urfusion Oct 26 '15 at 19:14
  • @as_whitley : any success ? – urfusion Oct 28 '15 at 08:56
  • the default port of 3306 is open and the mysql version is 5.1. – as_whitley Oct 28 '15 at 12:57
  • Also, just as an update, I performed a secondary magento installation in another file location on the same host, created a database, and was able to get that one up and going just fine. For whatever reason just this one instance is not working. I am going to reupload files this morning just to make sure that a file is not corrupted and causing this error. – as_whitley Oct 28 '15 at 13:00
  • @as_whitley : try to connect your old installation with the new credentials which you created for your new instance – urfusion Oct 29 '15 at 07:55
  • I substituted the credentials from my working magento installation. Still get the exact same error. @urfusion, you are amazing. You are still trying to get this figured out when most people would have given up. Thanks! – as_whitley Oct 29 '15 at 11:26
  • I always love puzzles :) – urfusion Oct 29 '15 at 11:36
  • @as_whitley : any luck? – urfusion Oct 30 '15 at 16:39
  • No change. Still getting the same error. I am beginning to think it is a problem with the host or the database itself. You would think that using both files and credentials from another working site would solve the problem. – as_whitley Oct 30 '15 at 18:37
  • Yup, they should. Now i think that this might be server issues or might be some files are missing.. – urfusion Oct 30 '15 at 18:39
0

have you checked your local.xml under app/etc or if you already done that then rename your local.xml and enter your website url on browser ,you will see installation panel, install your website again with right credentials i hope this work!!!

faizanbeg
  • 391
  • 2
  • 9
  • I tried your suggestion of renaming local.xml and then bringing up the page in my browser. I still get the same error page with a comment directing me to the error report. Here is the same error from the first line in the error report: `a:5:{i:0;s:48:"SQLSTATE[HY000] [2002] No such file or directory";i:1;s:2969:"#0 /homepages/25/d336955856/htdocs/mfg_oldSite/product-catalog/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()` – as_whitley Oct 26 '15 at 11:44
  • It was the very first line on the report. Not sure how to tell if it was before or after installation page. – as_whitley Oct 28 '15 at 11:17
  • ok, I thnk its your server problem contact to server administrator, can you provide me url of the site. – faizanbeg Oct 28 '15 at 11:37
-1

Hey please follow the following step it will remove the error

1) Rename the your local.xml file,

2) Delete all cache files form your system.

3) Run your site in your browser it will ask for the configuration steps.

4) Follow the steps and select the add database detail which you have updated in your live site.

It will setup all thing and the data will be same as it is.

Mitul
  • 3,431
  • 2
  • 22
  • 35