Getting "unable to create database" errors during installation wizard

When I try to create OpenMRS database in enterprise mode I get this error message:

what should I do about it? thank you…

Dear @hossam, it looks like you’ve got a database connectivity issue. Here are a few things to check. 1.) Make sure the database is running. 2.) Ensure the username/password you specified, on the previous of the screen works.
3.) Ensure the username/password works from the host where you are running Tomcat/OpenMRS. MySQL users have a host linked to them, so it’s possible for a user to be able to log in from one computer, and not from another. 4.) Ensure the MySQL port isn’t blocked by a firewall. 5.) Ensure you’re trying to connect to the right port (from the settings on the previous screen). 6.) Ensure the MySQL user has rights to create a database.

Those are just some quick thoughts that come to mind of possible causes.

3 Likes

I checked everything you kindly mentioned. now I get this message:

I tried copying the runtime properties file from my standalone OpenMRS to the directory of enterprise OpenMRS but it still didn’t work and the same message appeared.

It looks like it’s having trouble finding your runtime properties file. You can ensure that the user that Tomcat runs under has full permissions to all of the places that it’s looking for a runtime file. I had a similar problem recently on Linux, and that was the solution.

If you were to copy the runtime properties file from your standalone, you would need to edit it to make the information in it match your “production” server requirements; database username and password for example.

Hope this helps, if not, maybe someone else will be able to help you out. That’s the beauty of the OpenMRS community.

1 Like

ok so I came across this page explaining how to establish a connection between MySQL and Tomcat https://www.mulesoft.com/tcat/tomcat-mysql

It says that Step 1: Download the MySQL JDBC Driver (which I did) Step 2: Configure Your MySQL Database as a JNDI Resource (which I didn’t cause…whaaat? :slight_smile: )

Then it goes on to say: "Step 2a: JDBC Resource Configuration:

The Resource Element defines server-specific information about your database, including URL, database type , driver, and authentication information. As mentioned above, there are two ways to define this information - as a GlobalNamingResource, if multiple Contexts will need access to a single database, or on a Context by Context basis.

As the second of these is the more common usage, let’s look at that first. If you’ll need to use a GlobalNamingResource, click here to skip ahead.

Per-Context JDBC Resource Configuration

All actively supported versions of Tomcat allow configuration of Contexts through either an entry in Server.xml or through a Context XML fragment in your application’s “META-INF/context.xml” file. We strongly recommend you use the second option, as this will allow you to make changes to your database configuration without restarting your entire server, and also make your application more portable."

so in our case the application is OpenMRS, correct?

I can’t do this…I have no idea what to do… that’s all I can do.

Good morning @hossam.

OpenMRS doesn’t use the MySQL JDBC Driver. It communicates directly with MySQL, using the username / password from the runtime properties file.

On your server where OpenMRS is running, can you open a Command Prompt, and try connecting to MySQL with the MySQL client?

mysql -u yourusername -p 

It should prompt you for your password.

After you log in, try to create a database with something like this…

CREATE DATABASE `mydb` CHARACTER SET utf8 COLLATE utf8_general_ci;

That would be a good way to test that your MySQL is working properly and that your username/password works and has sufficient privileges, and it’s not being blocked by a firewall, etc.

Then, when you run the setup wizard, make sure you’re using that same username/password.

4 Likes