MySQL Server Error

Hi All,

When I try to log into my local  emoncms account (192.168.1.1XX) I keep getting the following error: 

<b>Warning</b>:  mysqli::mysqli(): (HY000/2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in <b>/var/www/emoncms/index.php</b> on line <b>26</b><br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

TIA for any help!

Ian 

 

Automate's picture

Re: MySQL Server Error

Are you running on Windows or Linux?  Is your MySQL running on the standard port of 3306?  What values did you put into settings.php

iansalias's picture

Re: MySQL Server Error

Spam filter wont let me post reply...

Ian

 

I Keep gettng:

"The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes."

===================================================

[This is what Ian tried to post - Moderator]

Hi Automate,

I am running this on a Raspberry Pi using Linux. I followed the instructions on the emoncms.org web site on installing the system on the SD card. See: http://emoncms.org/site/docs/raspberrypiimage

I looked through the set up instructions on the "Build from scratch" page (http://emoncms.org/site/docs/raspberrypibuild) and found settings.php under item number 9. iIs that the one you mean? The settings it had were just empty quotation marks listed so I added:

$username = "root";


$password = "raspberry";


$server   = "localhost";


$database = "emoncms";

I started going through the "Build from scratch" page and have found that the software is installed but not set as per the instructions on this page. When I get to item #8 Create a MYSQL database and enter the command: mysql -u root -p it asks for my password. When I enter it I get the same error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.cxock' (2)

Can I reset my MySQL password? How do I see if MySQl is running on port 3306?

Thanks for your help!

Ian

 

Automate's picture

Re: MySQL Server Error

Sorry, I'm not using the Raspberry Pi so I don't know the default  username / password.

You could try to connect to the RPi 3306 port using a telnet client to check if MySQL is listening.

Robert Wall's picture

Re: MySQL Server Error

I have seen the default RPi user name and password published - here. If you have phpmyadmin, you can set the MySQL user names and passwords in there.

iansalias's picture

Re: MySQL Server Error

This had been working at one point and I changed the password to the localhost/emoncms website. I did switch it again to a simpler password and that is when my troubles began...

I used Terminal on Mac OS X to Telnet to localhost 3306 and could not connect. I also tried the Mac OS X Network utility and Zenmap to look for open ports and neither listed port 3306 as open. Zenmap did detect the Linux OS and the version number so I know it is connecting to the Raspberry Pi. 

Maybe I should try a fresh install of the Emoncms software...

 

Jérôme's picture

Re: MySQL Server Error

I setup an install with user/pwd test/test. Then I decided to change for a more secure pwd. Then I forgot the password...

No need to reinstall.

Easy solution : create a new user (and delete the other one from the database with phpmyadmin).

More complicated but keeping same user : find out which hash algo is used to encrypt the password (no time to search right now, maybe somebody knows), generate such a hash for a known password (maybe there's a command for that on Mac OS X, otherwise, you may find web pages that can do that, like this one: http://www.md5hashgenerator.com/), and replace it in the DB using phpmyadmin.

Robert Wall's picture

Re: MySQL Server Error

Ian, I'm confused as to which password you've lost. Is it the one that emonCMS uses to put the data into MySQL, or is it the password YOU use to get into emonCMS?

Jérôme's picture

Re: MySQL Server Error

I may have added to the confusion after reading this

This had been working at one point and I changed the password to the localhost/emoncms website. I did switch it again to a simpler password and that is when my troubles began...

Indeed, former posts suggest rather a DB connection issue.

user/pwd couples recap:

- Raspberry Pi user (generally user Pi)

- DB connection (can be root/pwd or a specific user/pwd, the doc suggests root but I created a emoncms user to separate the privileges in the DB)

- emoncms user (the one you use to login, this is visible in the URL of public dashboard)

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.