Database connection

i have two apps and two site and each site have individual database created when i create site.

  1. site one is meeting.dev and database is :bcad64afbf268a6a

  2. site another one is cdcl.dev and database is :4c609e94a99a291b

  3. Hosts file setting are:

     127.0.0.1	meeting.dev
    
     127.0.0.1	cdcl.dev
    
  4. site_config.json file for meeting:

    {
    “db_name”: “bcad64afbf268a6a”,
    “db_password”: “l9mONAM3sKoXXwZ6”,
    “developer_mode”: “1”,
    “host_name”: “http://meeting.dev:8000

    }

  5. site_config.json file for cdcl.dev

    {
    “db_name”: “4c609e94a99a291b”,
    “db_password”: “EFXnq6yXTcbFRZzg”,
    “encryption_key”: “MacJk7OrhUVfjaaarV8nWeR08WfGcTmG454k4XVBJtE=”,
    “limits”: {
    “space_usage”: {
    “backup_size”: 220.0,
    “database_size”: 273.21,
    “files_size”: 0.0,
    “total”: 493.21
    }
    }
    }

The problem is both the apps are using site_config.json file of cdcl.dev and its database.

cdcl.dev is create before and meeting.dev is create after one week.

i don’t know why both are using cdcl.dev connection and database. actually meeting.dev should use its connection and database.

is there any file connection setting which use for commond use.

please help me

thanks in advance .

Hi @kinzang,

have you created both sites using

bench new-site cdcl.dev
bench new-site meeting.dev

The subfolders in ./sites should not mix up in a standard config…

yes, i have created using bench new-site

i am new in frappe as wel in erpnext also… please guide me to solve this issue @lasalesi.

This might sound strange, but how do you know that they are using the same file? What happens if you run

bench mysql --site meeting.dev

Which db is loaded?

thanks @lasalesi,

i have lots of user and data in cdcl.dev databases, but in meeting.dev one have default user only and dose not have any data.
so when i brows meeting.dev and used the user of cdcl.dev, i can open and display all the data of cdcl.dev.
And then i changed the database name in site_config.json file of cdcl.dev and try to brows both site but is said database error. this shows it is using cdcl.dev database.

I am not quite sure if I can follow… If you access http://meeting.dev, it should open the site from the respective ./sites. And in there, it will load the corresponding db connection. Maybe it helps to check whether the http request arrives properly in the nginx log files. And control your multitenancy configuration (refer to Multitenant Setup · frappe/bench Wiki · GitHub)

thank @lasalesi, i ll try.

@kinzang

Have you enabled multi-tenant setup yet?

bench config dns_multitenant on

sorry for let reply,
yes, it solved by clearing currentsite.txt. it should be empty.