Database management

SSH tunnel options

You can use an SSH tunnel to connect to database from an external app (for example MySQL Workbench, HeidiSQL or PHPStorm)

  1. Uncomment ports directive in database service in docker-compose.yml
ports:
  - 127.0.0.1:${SSH_TUNNEL_EXT_PORT}:3306
  1. Edit the .env.main file, find SSH_TUNNEL_EXT_PORT – make sure that the port is unique. If you are using multiple instances, change the port value.
  2. Open your database management app and configure SSH tunnel, database connection

phpMyadmin options

To use phpMyadmin need to run the phpMyadmin container first. It’s not running by default.

  1. Edit the .env.main file, find PMA_EXT_PORT – make sure that the port is unique. If you are using multiple instances, change the port value.
  2. Run phpMyadmin container:
make pma
  1. Open the your-app-domain.com:PMA_EXT_PORT URL in the browser to access phpMyadmin. For example, we use PMA_EXT_PORT=8801. Open your-app-domain.com:8801

⚠️ WARNING 📣 Do not use phpMyadmin on public (production or open stage), it’s not secure!

Reset database root password

  1. In docker-compose.yml file uncomment command: --skip-grant-tables in mariadb service
  2. Restart containers:
make restart
  1. Enter inside mariadb container:
make exec mariadb
  1. Inside container run:
 mariadb> FLUSH PRIVILEGES; ALTER USER 'root'@'%' IDENTIFIED BY 'new_password';

Where ‘new_password’ – new root password

You can reset another database user password too – just change the username, host, and add new password.

For example, there are two root users in database – with % host and with localhost. Use this command to see all users:

SELECT User, Host FROM mysql.user;
  1. Revert back changes in docker-compose.yml
  2. Restart containers:
make restart