How to access the site's database [Advanced, Unsupported]

:warning: Advanced workflow. You could easily break your site. :warning:

It is possible to connect to your website’s database directly. This is a dangerous and unsupported workflow, which you might want to follow only if you are a Drupal expert.


  • Ask :snowflake: the Drupal Infrastructure for elevated permissions on your website.
    • we might not be able to give you our standard level of support if you encounter issues probably caused by your elevated privileges
  • Install the oc command line client, or use the kubectl utility on
    • kubectl does not offer a direct equivalent to oc login. You will need to use a token.
  • Install the mysql DB command line client
    • with the connection information, you can use any other client of your choice instead, including graphical clients, a suggested client is
  • Access the database from inside CERN. The CERN firewall prevents you from connecting to the database while teleworking (workarounds are possible though)
  • Access the Drupal cluster from inside CERN (same reason)


  1. Connect to the Drupal cluster:

    oc login --server= -u <username>
  2. Get the DB connection string for your website. If your website is called eg MYSITE, run this in a terminal:

    oc -n PROJECT exec -c php-fpm deploy/MYSITE -- drush sql-connect

    Example output:

    mysql --user=0d4f580 --password=hSnc52hSN7C3 --database=0d4f580 --port=7857 -A
  3. Use the mysql command line directly to connect, or use only the connection info with your favorite client.

    If you want to access with DBeaver:

       1. After installing, select new connection 


       2.  Select MySQL DB

       3. Set the values retrieved on the previous step (all the points in red) 

       4. For allowing access outside of CERN
       First we select the SSH section (yellow), and then fill the two necessary fields(red), Host/IP is always ``, UserName is your user account.

       5. Finally, we select the databases on the top left corner and navigate the DB


Any changes you make to the database you connect to can directly affect your website.