Create MySQL INI File: Complete Guide

You can create an ini file in MySQL using the following steps.

  1. Create a new text file and name it whatever you want with a .ini file extension (e.g. my.ini).
  2. Open this .ini file and add MySQL configuration options in the following format:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

This is a simple example, in which you can add more configuration options according to your needs.

  1. Save this .ini file and place it in the directory of the MySQL configuration file (usually in /etc/mysql/).
  2. During MySQL startup, you can specify the use of this .ini file by using the following command:
mysql --defaults-file=/etc/mysql/my.ini

In this way, MySQL will start using the configuration options in the .ini file you created.

Please note that you need to restart MySQL after updating the .ini file for changes to take effect.

bannerAds