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.
Linux and macOS native installer users can identify which database server is used in the stack by running the command below:
$ test -d installdir/mariadb && echo "MariaDB" || echo "MySQL"
Windows native installer users can identify which database server is used in the stack by checking for the presence of the installdir/mariadb directory. If present, the installer uses MariaDB and if not, it uses MySQL.
Depending on which database server (MySQL or MariaDB) is used by the installation, use the appropriate guides in our documentation for database-related operations.
Once you have created a new database and user for your application, connect to your MySQL server and follow these recommendations:
Remove anonymous users:
mysql> DELETE FROM mysql.user WHERE User='';
Remove the test database and access to it:
mysql> DROP DATABASE test; mysql> DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
Disallow root login remotely:
IMPORTANT: Please ensure the mysql.user table includes a ‘root’@‘localhost’ entry. Otherwise, you will lose admin access to the database when running the next command
mysql> DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
Don’t forget to reload the privileges tables to apply the changes:
mysql> FLUSH PRIVILEGES;
It is strongly recommended that you do not have empty passwords for any user accounts when using the server for any production work.
If you don’t need remote access, uncomment the line
in the MySQL configuration file to only listen for connections on the local machine. Restart the server once done.