(beginner) OpenMRS standalone is running, but I can't access the database through the command line

21 views
Skip to first unread message

Allie Lake

unread,
Jun 17, 2014, 10:52:42 AM6/17/14
to implem...@openmrs.org
Hi all,

I have OpenMRS 2.0 (standalone) up an running on my computer, but I am having trouble accessing the mysql database from the command line.  When I cd into the database/bin directory and execute the following commands as specified by the standalone documentation:

> Allie:bin Allison$ ./mysql -u openmrs -p

and then enter the password listed in the openmrs-standalone-runtime.properties file, I get the following error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I had mysql installed on my computer before installing the standalone version of OpenMRS, but I just started having this problem yesterday.

I Googled the error message and tried the following solutions to no avail:
  • specifying the host as 127.0.0.1
    • > Allie:bin Allison$ ./mysql -h127.0.0.1 -u openmrs -p 
    • Enter password: 
    • ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)
  •  specifying the protocol as TCP
    • > Allie:bin Allison$ ./mysql -h127.0.0.1 -u openmrs --protocol=tcp -p 
    • Enter password: 
    • ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)
  • uninstalling my global installation of mysql using these instructions (didn't help)
  • re-installing OpenMRS standalone from the .zip file (didn't help)

I am running Mac OSX 10.9.3. I'll also copy-paste the contents of my openmrs-standalone-runtime.properties file:

#Last updated by the OpenMRS Standalone application.
#Mon Jun 16 17:35:31 PET 2014
vm_arguments=-Xmx512m -Xms512m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=128m
connection.username=openmrs
connection.password=tJ@X1HO|KZDZ
module.allow_web_admin=true
tomcatport=8081
application_data_directory=appdata
auto_update_database=false

Please help! Thanks!

Allie (an OpenMRS beginner)

Pascal Brandt

unread,
Jun 17, 2014, 10:55:56 AM6/17/14
to implem...@openmrs.org
Hi Allie,

I believe that the embedded MySQL that comes with the standalone doesn't run on the default port. Check the standalone UI for the MySQL port number (looks like 3316 from what you pasted above) and make sure that you specify that port number when trying to connect to the database.

Cheers,
Pascal


--
OpenMRS Implementers: http://go.openmrs.org/implementers
Post: implem...@openmrs.org
Unsubscribe: implementers...@openmrs.org
Manage your OpenMRS subscriptions at https://id.openmrs.org/

To unsubscribe from this group and stop receiving emails from it, send an email to implementers...@openmrs.org.

Daniel Kayiwa

unread,
Jun 17, 2014, 10:57:49 AM6/17/14
to implem...@openmrs.org
Did you read all on that page? It has this exact error message and solution. :)


--
OpenMRS Implementers: http://go.openmrs.org/implementers
Post: implem...@openmrs.org
Unsubscribe: implementers...@openmrs.org
Manage your OpenMRS subscriptions at https://id.openmrs.org/



--
If we keep uppermost in our minds the unkind and unjust acts of others, we shall find it impossible to love them as Christ has loved us; but if our thoughts dwell upon the wondrous love and pity of Christ for us, the same spirit will flow out to others.

Allie Lake

unread,
Jun 17, 2014, 11:04:42 AM6/17/14
to implem...@openmrs.org
Daniel -- I'm not sure which page you're referring to, but specifying the port number did the trick! Thanks, Pascal!

Allie


To unsubscribe from this group and stop receiving emails from it, send an email to implementers...@openmrs.org.

Pascal Brandt

unread,
Jun 17, 2014, 11:08:00 AM6/17/14
to implem...@openmrs.org
Sure, no problem.

I think Daniel was referring to this page and this Tip:

  • If you try connecting to the MySQL server from commandline and get this error message: "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)":
    • Add this "&server.socket=/tmp/openmrs.sock" (without the double quotes) at the end of the value in the connection.url key of the runtime properties file, and then restart the standalone application. If after doing that, you still get the same error message, then on your command line, add this: --socket=/tmp/openmrs.sock
    • Then you can connect with something like: ./mysql -u openmrs -p --socket=/tmp/openmrs.sock

Cheers,
Pascal
Reply all
Reply to author
Forward
0 new messages