Managing your database server the right way is essential for performance, stability, and data protection. Whether you use MySQL or MariaDB, configuring your settings based on your serverโs needs will help you get the most out of your setup. Follow the guide to configure MySQL and MariaDB using xCloud and explain the key configuration options in simple terms.
How to Configure MySQL for Your Server #
You can manage MySQL settings directly from the xCloud control panel. Follow the steps below to modify key database parameters of MySQL that affect performance and stability.
Step 1: Go to the Server #
Go to your server. From the sidebar, go to โManagementโ and then click on โMySQL Configurationโ.
Step 2: Adjust the Configuration options #
Here you will find all the configuration options โMax Connectionsโ, โMax Allowed Packetโ, โInnoDB Buffer Pool Sizeโ, โInnoDB Buffer Pool Instancesโ, โInnoDB Flush Log at Transaction Commitโ, โSlow Query Logโ, โLong Query Timeโ, โSort Buffer Sizeโ, โBinary Log Expire Timeโ, โInnoDB Flush Methodโ.
You can change these settings based on your server’s workload and resource availability.
Step 3: Apply Changes #
After you adjust the settings based on your server’s needs, review the values and click on the Save Changes button. The new configuration will be applied immediately.
How to Configure MariaDB for Your Server #
Just like MySQL, you can adjust MariaDB configuration from the xCloud control panel. Follow the steps below to modify key database parameters of MariaDB and apply changes based on your serverโs needs.
Step 1: Go to the Server #
Go to your server. From the sidebar, go to โManagementโ and then click on โMariaDB Configurationโ.
Step 2: Adjust the Configuration options #
Here you will find all the configuration options โMax Connectionsโ, โMax Allowed Packetโ, โInnoDB Buffer Pool Sizeโ, โInnoDB Buffer Pool Instancesโ, โInnoDB Flush Log at Transaction Commitโ, โSlow Query Logโ, โLong Query Timeโ, โSort Buffer Sizeโ, โBinary Log Expire Timeโ, โInnoDB Flush Methodโ.
You can change these settings based on your server’s workload and resource availability.
Step 3: Apply Changes #
After you adjust the settings based on your server’s needs, review the values and click on the Save Changes button. The new configuration will be applied immediately.
Configuration Options for MySQL and MariaDB #
When you configure MySQL or MariaDB, you will deal with several important settings. These settings affect how well your server performs, how stable it stays under pressure, and how safe your data is. Here is a simple explanation of each option so you can make informed decisions.
Max Connections #
This setting controls the maximum number of client connections that your database can handle at the same time. If your application has many users, increase this value based on your server’s CPU and RAM. Too many connections without enough resources will cause connection errors.
Max Allowed Packet #
This sets the maximum size of a packet that your server can handle in a single transaction. If your application sends large data chunks, such as files or long queries, you may need to raise this value. Use values like 64M or 128M, depending on your needs.
InnoDB Buffer Pool Size #
This defines how much RAM is used to cache data and indexes. It is a major factor in overall performance. A good rule is to allocate 70 to 80 percent of available memory for this setting. Use 128M for smaller systems, or 1G and higher for large workloads.
InnoDB Buffer Pool Instances #
This option breaks the buffer pool into multiple parts. Doing so helps performance, especially if your server has multiple CPU cores. It reduces contention and allows smoother handling of concurrent queries. In MariaDB, this feature is maintained by MariaDB, ensuring optimized performance tailored for its database environment.
InnoDB Flush Log at Transaction Commit #
This controls how often transaction logs are written to disk. There are three settings:
- 0 gives the best speed but risks losing recent data if the server crashes.
- 1 is the default and ensures the highest data safety.
- 2 is a balance between performance and durability.
Pick the one that fits your data safety needs.
Slow Query Log #
Turn this ON if you want to track slow queries. It helps you detect performance issues. The log file is usually stored at /var/log/mysql/mysql-slow.log. You can disable it when you do not need it.
Long Query Time #
This works with the slow query log. It sets the time (in seconds) that a query must run before being labeled as “slow.” Adjust it to match your idea of slow performance.
Sort Buffer Size #
This controls how much memory is used for sorting operations like ORDER BY or GROUP BY. If your application performs a lot of sorting, increasing this value can help. Use values between 256K and 2M, depending on your server memory.
Binary Log Expire Time #
This setting defines how long binary logs are kept before deletion. These logs help with replication and recovery but can use up disk space. Setting a shorter expiry time will free up space automatically.
InnoDB Flush Method #
This setting controls how data is written to disk. Your choice depends on your storage device.
- fsync is standard and works well for most setups.
- O_DIRECT is good for SSDs and helps reduce memory use by skipping the OS cache.
- Other options like O_DSYNC, littlesync, nosync, and O_DIRECT_NO_FSYNC offer different performance trade-offs.
If you are using SSD storage, O_DIRECT is usually the best option.
Make sure you adjust these settings based on your actual server usage and the hardware resources available. With proper configuration, both MySQL and MariaDB can deliver strong performance and high reliability.
And thatโs it, this is how easily you can configure MySQL and MariaDB for your server in just a few clicks.
Still stuck? Contact our support team for any of your queries.