How To Install and Configure MariaDB on Window Server 2022
To build and manage a powerful and efficient database system, MariaDB is a great choice thanks to its outstanding features and high performance. Installing and configuring MariaDB on Windows Server not only helps optimize system performance but also ensures data stability and security.
This article will guide you step by step to install and configure MariaDB on Windows Server platform, from downloading the installation package, performing the installation to setting up the necessary configuration parameters. Thereby, you will have an overview and details of the MariaDB setup process, helping you easily deploy and manage your database effectively. To install and configure MariaDB on Windows Server, you can follow these steps:
1. Install MariaDB
Visit the MariaDB download page here
Select the appropriate MariaDB version and download the .msi installation file
Run the .msi installation file you downloaded. During the installation process, you will be asked to choose configuration options. Some of the main steps include:
- Set root password: You will be asked to enter the password for the MariaDB root account. Remember this password as it is very important
- Select port: Default is 3306. You can change it if needed (We recommend you choose port 3306 of the default server”).
- Select character set: Default is utf8. You can select another character set if needed (We also recommend selecting the “use UTF8 as default server character set” option).
And complete the installation process.
2. MariaDB Configuration
Once installed, you need to configure MariaDB. You can edit the my.ini configuration file located in the MariaDB installation directory, for example C:\Program Files\MariaDB 11.7\data\my.ini. Open the my.ini file with Notepad or another text editor and make the necessary changes. Some common configuration options include:
- Change data directory: Change datadir if you want to store data in a different location
- Performance optimization: Customize parameters like innodb_buffer_pool_size, max_connections, etc.
3. Starting and stopping MariaDB
You can start and stop the MariaDB service via Services in Windows.
- Open Run (Win + R), type services.msc, and press Enter.
- Find the MariaDB service, right-click and select Start to start or Stop to stop the service
4. Test MariaDB connection
Open Command Prompt or PowerShell. Enter the following command to connect to MariaDB using the root account:
Note: you need to navigate MariaDB’s pin, for example:
cd C:\Program Files\MariaDB 11.7\bin
mysql -u root -p
Enter the root password you set during installation.
5. Create database and users
Once the connection is successful, you can create a new database using the command:
CREATE DATABASE database-name;
Create new user and grant permissions:
CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON database_name.* TO 'user_name'@'localhost';
FLUSH PRIVILEGES;
6. Configure firewall (if needed)
Open Windows Firewall and allow port 3306 (or the port you configured in my.ini) to allow remote access to MariaDB.
How to open a port in Windows Server Firewall
Remove MariaDB (if necessary)
Open Control Panel, select Programs and Features.Find MariaDB in the list, right-click and select Uninstall
Conclusion
Hopefully the above steps will help you to successfully install and configure MariaDB on Windows Server. If you face any problem, please check the steps again or search for more documentation on the official MariaDB website.
Good Luck!