Rechercher dans le manuel MySQL
2.3.4.2 Creating an Option File
If you need to specify startup options when you run the server, you can indicate them on the command line or place them in an option file. For options that are used every time the server starts, you may find it most convenient to use an option file to specify your MySQL configuration. This is particularly true under the following circumstances:
The installation or data directory locations are different from the default locations (
C:\Program Files\MySQL\MySQL Server 8.0
andC:\Program Files\MySQL\MySQL Server 8.0\data
).You need to tune the server settings, such as memory, cache, or InnoDB configuration information.
When the MySQL server starts on Windows, it looks for option
files in several locations, such as the Windows directory,
C:\
, and the MySQL installation directory
(for the full list of locations, see
Section 4.2.2.2, “Using Option Files”). The Windows directory typically
is named something like C:\WINDOWS
. You can
determine its exact location from the value of the
WINDIR
environment variable using the
following command:
C:\> echo %WINDIR%
MySQL looks for options in each location first in the
my.ini
file, and then in the
my.cnf
file. However, to avoid confusion,
it is best if you use only one file. If your PC uses a boot
loader where C:
is not the boot drive, your
only option is to use the my.ini
file.
Whichever option file you use, it must be a plain text file.
When using the MySQL Installer to install MySQL Server, it will create
the my.ini
at the default location, and
the user executing MySQL Installer is granted full permissions to this
new my.ini
file.
In other words, be sure that the MySQL Server user has
permission to read the my.ini
file.
You can also make use of the example option files included with your MySQL distribution; see Section 5.1.2, “Server Configuration Defaults”.
An option file can be created and modified with any text editor,
such as Notepad. For example, if MySQL is installed in
E:\mysql
and the data directory is in
E:\mydata\data
, you can create an option
file containing a [mysqld]
section to specify
values for the basedir
and
datadir
options:
[mysqld]
# set basedir to your installation path
basedir=E:/mysql
# set datadir to the location of your data directory
datadir=E:/mydata/data
Microsoft Windows path names are specified in option files using (forward) slashes rather than backslashes. If you do use backslashes, double them:
[mysqld]
# set basedir to your installation path
basedir=E:\\mysql
# set datadir to the location of your data directory
datadir=E:\\mydata\\data
The rules for use of backslash in option file values are given in Section 4.2.2.2, “Using Option Files”.
The ZIP archive does not include a data
directory. To initialize a MySQL installation by creating the
data directory and populating the tables in the mysql system
database, initialize MySQL using either
--initialize
or
--initialize-insecure
. For
additional information, see
Section 2.10.1, “Initializing the Data Directory”.
If you would like to use a data directory in a different
location, you should copy the entire contents of the
data
directory to the new location. For
example, if you want to use E:\mydata
as
the data directory instead, you must do two things:
Move the entire
data
directory and all of its contents from the default location (for exampleC:\Program Files\MySQL\MySQL Server 8.0\data
) toE:\mydata
.Use a
--datadir
option to specify the new data directory location each time you start the server.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-windows-create-option-file.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.