Unfortunately site_config.json file is empty

When I have open my site suddenly got this error.

Then I saw my site_config.json file empty.
Could any one suggest me what do if my site_config.json file db_name and db_password is empty.

“db_name”: " ",
“db_password”: " "

Is there any suggestion to solve this problem.
Please help.

Is this a new site or you have data in it?

If it’s a fresh site, have you faced any error while creating the site?

Hi Sir thank you for your reply.

We have some live data also. So we dont want create a new site for it.

It has been working from 1.5 yr .

Sir please help.

Do you have multiple sites on instances or you have only one site on the instance?

  • If you have only one site,

    • Login to MySQL, mysql -u root -pPASSWORD
    • From the MySQL console run, show databases
    • Copy database name from this list, database name is alphanumeric
  • If you have multiple sites,

    • Open python console on a terminal and run following code
       import hashlib
       db_name = hashlib.sha1('[your-site-name]'.encode()).hexdigest()[:16]
    • copy the db_name
    • Now login to MySQL console and check whether the database exists in the MySQL with the same name.
  • As site_config.json is empty, we have to reset the password for the database in both above cases

    • login to mysql as a root user, mysql -u root -p
    • On the mysql console, use mysql
    • update user set password=PASSWORD(‘71eb94d8a79b675c’) where User=[db_name_we_got_from_above_stes]';
    • flush privileges;
  • Now update db_name and password in site_config.json


Thank You so much.

I never forgot your help.

Thanks again for your quick respond and it gave me the wonderful solution.

This can happen when your disk space is full exactly at the time when frappe is updating disk usage stats is site_config.json.

You may want to check if there’s enough space (command below) to avoid this issue.
du -h