Advanced workflow. You could easily break your site. ![]()
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.
Prerequisites:
-
Ask
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
occommand line client, or use thekubectlutility onlxplus8.cern.ch-
kubectldoes not offer a direct equivalent tooc login. You will need to use a token.
-
- Install the
mysqlDB command line client- with the connection information, you can use any other client of your choice instead, including graphical clients, a suggested client is https://dbeaver.io/
- 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)
Workflow:
-
Connect to the Drupal cluster:
oc login --server=https://api.drupal.okd.cern.ch -u <username> -
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-connectExample output:
mysql --user=0d4f580 --password=hSnc52hSN7C3 --database=0d4f580 --host=dbod-ha-proxy.cern.ch --port=7857 -A -
Use the
mysqlcommand 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 DB3. 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 `lxtunnel.cern.ch`, 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.


