Computer >> Computer tutorials >  >> Programming >> MySQL

Set Optimal MySQL configuration in my.cnf?


First, you need to open my.cnf file. The following is the query to get the directory location of the config file on Windows −

mysql> select @@datadir;

Output

+---------------------------------------------+
| @@datadir                                   |
+---------------------------------------------+
| C:\ProgramData\MySQL\MySQL Server 8.0\Data\ |
+---------------------------------------------+
1 row in set (0.00 sec)

Here is the snapshot of the directory −

Set Optimal MySQL configuration in my.cnf?

Now open my.cnf file. The snapshot is as follows −

Set Optimal MySQL configuration in my.cnf?

If you want to add more data to cache, then use the following query −

innodb_buffer_pool_size = 1024M

If you want to write more data, then use the following query −

innodb_log_file_size = 512M

We have set both the above options in my.conf file as shown below −

Set Optimal MySQL configuration in my.cnf?