
MariaDB is a popular open-source database management software commonly used as the drop-in replacement to MySQL that uses the same command syntax. This guide explains how to install and configure MariaDB on a server running OpenBSD 7.
Log in to the server as root through SSH or the web console.
Install MariaDB from the OpenBSD repository.
Configure MariaDB to start at boot time.
Start the MySQL daemon.
Verify that MariaDB has started.
Run the mysql_install_db script to create the necessary system tables and binary files.
Run the mysql_secure_installation script to remove the test database and insecure default settings that may put your production server at risk of attack. Choose your desired settings when prompted and set a strong root password.
Enable the mysql socket at /var/run/mysql.sock and allow the MariaDB to listen on port 3306 for client connections. Open /etc/my.cnf in your favorite editor.
Uncomment the socket and port entries below[client-server]. When finished, that section should look like this:
Save and close the file.
If you intend to use MariaDB with a web server, install the required PHP modules to establish a connection with hosted applications.
Install the PHP MySQL modules.
Test the MySQL connection by running a simple PHP script in your webroot directory.
Paste the following code. Replace username and password with your actual credentials:
Visit your server IP in a web browser and load test.php.
Your output should be:
Login to the MariaDB console as root.
Enter the root password you set earlier.
Create a new sample database.
Create a new standard user with a strong password.
Grant the user full permissions to the sample database.
Reload the privileges.
Exit the console.
Log in to the MySQL console again, this time as a standard user.
Check the current databases accessible by the user.
Exit the console.
You have successfully installed and configured MariaDB on OpenBSD 7, and the database server can connect with other applications installed on the server, including web stacks like Nginx, httpd, and apache2-httpd through its run time socket and PHP.
0 Comments
Be the first to comment and share your perspective with the community.