Hi @Yanara_Debora ,
I asked AI : “I am using OpenEMR on a cloudhosted server (Ubuntu). how do I go about accessing the database”
Here is what I got:
Accessing OpenEMR Database on Ubuntu Cloud Server
Step 1: SSH into Your Server
bash
ssh username@your-server-ip
Replace username with your actual username and your-server-ip with your server’s IP address.
Step 2: Locate Database Credentials
Once connected via SSH, find your database credentials in the OpenEMR configuration file:
bash
sudo cat /var/www/html/openemr/sites/default/sqlconf.php
This will show you:
-
$host - Database host (usually localhost)
-
$dbase - Database name (usually openemr)
-
$login - Database username
-
$pass - Database password
Step 3: Connect to the Database
Using the credentials from Step 2:
bash
mysql -u DATABASE_USERNAME -p DATABASE_NAME
For example, if your username is openemr and database is openemr:
bash
mysql -u openemr -p openemr
Enter the password when prompted (from the sqlconf.php file).
Step 4: Verify Connection
Once connected, you should see the MySQL prompt. Test with:
sql
SHOW TABLES;
This will list all tables in your OpenEMR database.
Alternative: Use Root Access
If the above doesn’t work, try connecting as root:
bash
sudo mysql -u root -p
Then switch to the OpenEMR database:
sql
USE openemr;
SHOW TABLES;
Note: Always backup your database before making any changes, and be cautious with direct database modifications as they can affect OpenEMR functionality.