How can I connect to erpnext database

I need to know the name of the mysql/mariadb database, the mysql/mariadb user name to use, and the password. I found the site_config file, but when I try to use those values, it fails to connect. Mysql command line tool tells me something like the user is not allowed to connect. BTW, I am doing this LOCALLY ON THE VM, not remotely. So it seems unlikely that host is the issue at this point (unless it is set up to use some kind of local loopback address, etc).

I also tried using the frappe --mysql approach; I get this:

frappe app is not installed. Run the following command to install frappe
bench get-app frappe
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==0.92’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/”, line 46, in cli
return old_frappe_cli()
File “/home/frappe/bench-repo/bench/”, line 98, in old_frappe_cli
os.execv(f, [f] + sys.argv[2:])
OSError: [Errno 2] No such file or directory

Incidentally, I did this successfully not long ago.

Can someone tell me how to connect to the erpnext database for the purpose of READONLY access only? I promise, I am NOT trying to corrupt or modify the database, only to fetch data and make a report. I’d appreciate it.

To connect to mysql do:

bench --site sitename mysql

You can also connect directly using the values in site_config.json


In my OP, I stated that I had found the site_config file and tried to connect directly using those values. It didn’t work. I know I can connect using the bench command, and that did work at least a few times for me.

Can you provide the command line syntax for connecting to mysql?

mysql -u erpnext -h erphostvm -p db66edfa

something like that I think. The last arg is the database name which is generated by the system, not by me.

Thanks if you can help.

Share your error message. hard to guess whats going wrong.