azure-templateswordpress

Connect to MySQL

NOTE: We are in the process of modifying the configuration for many Bitnami stacks. On account of these changes, the file paths and commands stated in this guide may change depending on whether your Bitnami stack uses MySQL or MariaDB. To identify which database server is used in your stack, run the command below:

 $ test -d /opt/bitnami/mariadb && echo "MariaDB" || echo "MySQL"

The output of the command indicates which database server (MySQL or MariaDB) is used by the installation, and will allow you to identify which guides to follow in our documentation for common database-related operations.

For Multi-Tier Solutions without Azure Database for MariaDB, you can connect to the database from the same computer where it is installed with the mysql client tool.

$ mysql -u root -p

For Multi-Tier Solutions with Azure Database for MariaDB, use the command below instead. Replace the USERNAME and HOSTNAME placeholders with the username and hostname for the Azure Database for MariaDB instance, which is available in the Azure portal (more information).

$ mysql -u USERNAME -h HOSTNAME -p

You will be prompted to enter the root user password. This is the same password entered during the server deployment process.

WordPress users can also obtain the database hostname by executing the following command:

$ sudo cat /opt/bitnami/wordpress/wp-config.php | grep 'DB_HOST'
Last modification October 21, 2020