Unable to connect to database error

Please help me to solve this error: “Unable to create the database. The password might be incorrect or the database is not started. ???Error executing sql: create database if not exists ? default character set utf8 - Could not create connection to database server. Attempted reconnect 3 times. Giving up.???” I have tried all existing solutions, such as downgrading the MySQL version, JDK version as well as tomcat version. Also I have attached the pastebin links where I run the program with runtime.properties file and without runtime.properties file. Please help. Without Runtime.properties - Pastebin.com With Runtime.properties - Pastebin.com

Your exception seems to indicate your MySQL server isn’t available.

Exception in thread “main” com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at…

What happens if you try (from the terminal)

mysql -u username -p

You will be prompted for the password associated with the username. After you give the correct password does the mysql client connect?

You may have to start MySQL from the Preferences if not. You can also set it to run at startup.

1 Like

Thanks for answering, I am able to login through the terminal, it connects to mysql but I get the same error.

Kindly share the java, mysql version you are running and the Platform/distribution version you are trying to install.

1 Like

Java version is 1.8.0_301 Mysql version is 5.7.32 The platform/distribution version is 2.3.2.

The most likely causes for why it cannot connect are:

  1. MySQL isn’t running
  2. MySQL isn’t running on port 3306
  3. Your MySQL instance isn’t configured to allow the root user to login with a user name and password
  4. The user name and password are incorrect

You can get more details by running mvn openmrs-sdk:setup -e .

If the issue is related to No 3, you might need to follow the steps [discussed here ](https://talk.openmrs.org/t/why-the-sdk-can-. not-find-this-plugin/33644/29) and after that.

1 Like

Points 1, 2 and 4 are not an issue, I have verified it. I cannot view the 3rd one, it says it’s hidden, any other version of it is available? Thanks again for the help.

Can we meet on this link https://meet.google.com/jsh-epds-waz?

1 Like

@nishchayp How do you find deploying MySQL through docker. If you are a Linux user, I can easily share the workflow. However, if you are a windows user, am not much of help on that.

1 Like

Sure, we can meet tomorrow, 10:00 am IST, I don’t know what time it will be in your place, or you can suggest a timing.

Thank you for answering, unfortunately I am using a windows system.

1 Like

Who has ever tried deploying MySQL using docker on windows? Has it worked for you? In my thinking, its a better alternative.

cc @herbert24

1 Like

Haven’t tried it yet, as of now I only use the command prompt and MySQL workbench for it.

@nishchayp have you confirmed that your mysql is running before you start anything.

Another alternative that worked for me before i changed to Linux was using MySQL 8.0 If you are good in adventure, you can unistall 5.7.** and try our 8.0

which version of openmrs,jdk and mysql are you running?

Yes, I confirmed that MySQL was running, as well as I was using the latest version of MySQL, it also did not work, that is why I tried downgrading to previous versions to see if that would work.

Java version is 1.8.0_301 Mysql version is 5.7.32 The openmrs platform/distribution version is 2.3.2.

try upgrading your MySQL 5 to MySQL 8 For MySQL 8 you need to select platform 2.4 and above or reference application 2.12.0-SNAPSHOT

this should be working @nishchayp ping me if you have some time and we try to have a call