Local database tunnel
The mariadb service never publishes a host port directly (in either single- or multi-instance mode), so the database is not reachable from the host by default. To connect from an external app (for example MySQL Workbench, HeidiSQL or PHPStorm), use make db-tunnel to spin up an ephemeral socat sidecar container on the compose network that forwards 127.0.0.1:<port> to the mariadb container’s 3306.
make up must have been run first – the tunnel script errors if the database container isn’t running.
- Start the tunnel:
make db-tunnel start
The default port is 3306. To use a different port:
make db-tunnel start 3307
- Check tunnel status:
make db-tunnel status
- Open your database management app and connect to
127.0.0.1:<port> - Stop the tunnel when done:
make db-tunnel stop
phpMyadmin options
To use phpMyadmin need to run the phpMyadmin container first. It’s not running by default.
- Edit the
.env.mainfile, findPMA_EXT_PORT– make sure that the port is unique. If you are using multiple instances, change the port value. - Run phpMyadmin container:
make pma
- Open the
your-app-domain.com:PMA_EXT_PORTURL in the browser to access phpMyadmin. For example, we usePMA_EXT_PORT=8801. Openyour-app-domain.com:8801
⚠️ WARNING 📣 Do not use phpMyadmin on public (production or open stage), it’s not secure!
Reset database root password
- In
docker-compose.ymlfile uncommentcommand: --skip-grant-tablesin mariadb service - Restart containers:
make restart
- Enter inside mariadb container:
make exec mariadb
- Inside container run:
mariadb --ssl=OFF
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;
- Revert back changes in
docker-compose.yml - Restart containers:
make restart