Change hostname of DB user created by bench for a site

The DB user created by bench user has the ip of the host as the value for the host field.
I need to change this to %.

I need to update the host from a script
One way I thought was to login as root and update the host column for the user. But I need to get the username from somewhere.

Question 1 : How can I retrieve the username of the DB user for a site?

Question 2 : Is there any other way to update the Host value?

Thanks in Advance.

Username and password are mentioned your site_config.json. It is available in the site folder.

A typical path will be : frappe-bench/sites/[your_site_name]/site_config.json


The site_config.json file contains the db name and the password, not the username.