I am unable to use local mysql when running 'mvn openmrs-sdk:setup, get bad db credentials

I installed mysql with sudo apt install mysql-server -y I verified it was running with sudo systemctl status mysql

   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2026-02-04 10:32:56 PST; 13s ago
    Process: 5578 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 5586 (mysqld)
     Status: "Server is operational"

I ran mvn openmrs-sdk:setup and selected the local mysql

Which database would you like to use?:
1) MySQL 5.6 and above (requires pre-installed MySQL 5.6 and above)
2) MySQL 8.4.1 and above in SDK docker container (requires pre-installed Docker)
3) Existing docker container (requires pre-installed Docker)
4) PostgreSQL 8.2 and above

Which one do you choose? [1/2/3/4]: 1

I took the default database uri

The distribution requires a MySQL database. Please specify database uri (-DdbUri) (default: 'jdbc:mysql://localhost:3306/@DBNAME@'):

I tried both ‘root’ and for the password, but neither worked

Please specify database username (-DdbUser) (default: 'root'): 
Please specify database password (-DdbPassword): ****

Database connection failed (attempt 1 of 3): Invalid database credentials. Please check your username and password.

Please specify correct database username (-DdbUser) (default: 'root'): 
Please specify correct database password (-DdbPassword): 

Database connection failed (attempt 2 of 3): Invalid database credentials. Please check your username and password.

Thanks in advance for any suggestions.

You can see, e.g., the Ubuntu docs here: Install and configure a MySQL server - Ubuntu Server documentation. By default, MySQL on many Linux versions defaults to only having the root user available to login via Unix socket (which the MySQL JDBC driver doesn’t really support).

Thank you! So I assume that I must do the following:

  • Log in as described in the link you sent.
  • Set the root password to password-of-my-choice
  • Use those credentials during the mvn openmrs-sdk:setup

I’m not sure, however, what to specify for the ‘database uri’ in this case. Would it be mysql://localhost:3306/@DBNAME@ ?

Yes, the URI should work with the default setup.

Thank you for your help. I apologize for continuing to bother you. I am still trying to get past the Invalid database credentials error while running mvn openmrs-sdk:setup. Before I list the things I’ve tried, I want to make sure that I’m not missing some documentation that describes the process. I have read the mysql setup described on the following pages. Please let me know if there is some documentation I missed.

https://openmrs.atlassian.net/wiki/spaces/docs/pages/25477418/Set+Up+OpenMRS+Server+with+OpenMRS+SDK

https://openmrs.atlassian.net/wiki/spaces/docs/pages/25475758/Windows

https://openmrs.atlassian.net/wiki/spaces/docs/pages/25475072/Step+4±+Install+MySQL#Debian%2FDebian-derived-distributions

So far I have tried the following, but get Invalid database credentials in all cases:

  • Setting the ‘root’ password. I don’t get any error messages when doing ALTER USER 'root'@'localhost' IDENTIFIED BY '<password>'; in mysql, but I’m unable to log in using mysql -u root -p

  • Creating a new user and giving it all privileges (e.g., GRANT ALL PRIVILEGES on mysql.* to 'fu'@'localhost' WITH GRANT OPTION;). I am able to log in using mysql -u fu -p

  • Modifying the uri as described here, e.g., mysql://fu:<password>@localhost:3306/

  • Trying both ports 3308 and 3306

FYI, I’m on Linux Mint (derived from Ubuntu). Thanks again.

“Resolved” by getting Docker to work: mvn openmrs-sdk:setup gives "invalid JSON: ParseAddr(\"localhost\"): unable to parse IP"