This guide explains how to change or set the default database for your Odoo instance.
Reasons to Change Your Default Database
When you work with multiple databases, things can get a confusing very quickly.
For example, if you have more than one PostgreSQL database in your Odoo instance, a user will be redirected to the database selector page first.
Alternatively, you might need to work on your test database for some time – or you might want your main database to be the one where your mail server is configured, for example.
In any case, if you set a default database, a user will skip the database selection screen and proceed to the website directly as if they chose that database.
Setting a Default Odoo Database
First of all, you must connect to your Odoo server via SSH in order to be able to execute commands on it.
Once you’re in, use this command to see the details of your Odoo process that is running on the background:
ps aux | grep odoo
You will see a list of processes that have the word ‘odoo’ in their process name/info. Look for a line like this (should start with odoo):
odoo 1043 0.3 7.4 408392 75092 ? Ssl 13:42 0:01 /usr/bin/python3 /usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log
As you can see, there is a ‘--config’ parameter (sometimes it’s just ‘-c’), which is followed by a file path. In this case, the path is /etc/odoo/odoo.conf.
Find the equivalent path in your output and write it down or remember it. That’s where the configuration file of your Odoo instance is located.
Open the configuration file:
sudo nano /etc/odoo/odoo.conf
You will see a list of configuration parameters in the following format: parameter = value.
Find the line that starts with db_name and change its value (typically False) to database name of your choice.
db_name = False
db_name = test_database
Note: change test_database to the actual database name that you want Odoo to use by default.
If you don’t want to reach the database selection page at all, find the parameter list_db and set its value to False.
list_db = True
list_db = False
Once you’ve made the changes, save and exit the file by pressing Ctrl + o and then Enter.
The final step is to restart Odoo:
sudo service odoo13 restart
If you are a SolaDrive customer and use one of our Odoo VPS Hosting services you can simply ask our expert Odoo specialists to set up the default database for you . We are available 24x7 via chat or ticket and will take care of your request immediately.