Setup: Error connecting to database as root

I’ve been trying to setup OpenEMR on localhost for hours now. I keep getting the error: “ERROR. Check your login credentials. unable to connect to database as root”. Note that above this is also the message " Warning : mysqli_connect(): (HY000/2002): No such file or directory in /Users/jon/Sites/openemr/library/classes/Installer.class.php on line 647". I have tried making the root password be my personal MySQL root password and I have tried leaving it blank. I have tried various passwords for the initial OpenEMR user password. I have looked at all of the threads I can find about this error on these forums and nothing has worked. I have also tried both the OpenEMR files I downloaded as a tar.gz straight from the website and I’ve tried cloning from Github. Nothing has worked. Any ideas?

Hi @hillery,

Sorry to hear you’ve been having so much trouble, let’s see if we can get this working.

First, what version of PHP are you using? I have an incling based on the file path it may be the built in PHP on macOS, which is likely a bit outdated (We currently require PHP >=7.1).

We have a couple of options if you are in fact using an outdated version of PHP. First, you could manually update the built in PHP version. Second, you could download MAMP, which will have a self-contained current version of PHP (MAMP is an Apache server, MySQL, and PHP all bundled into 1 app). Third, you could download Docker and then use our OpenEMR Container to get a version up and running.

I would recommend going the Docker route. It is by far going to be the easiest path to getting a local version of OpenEMR running on your machine. If you just want to have a demo version use the link above, if you want to develop OpenEMR I recommend following the steps found in our Contributing guide

THANK YOU! This is a much better solution. I will follow the contributing guide.

1 Like

Glad to help! Let us know if you have any other issues :slight_smile: