Reputation: 1234
Where can I setup "my.cnf" file on Windows? An automated backup script is running. And it is producing an on-screen message:
Warning: Using a password on the command line interface can be insecure.
Related to: MySQL "my.cnf" file
Upvotes: 1
Views: 5119
Reputation: 1
For Windows, "my.ini" is used instead of "my.cnf".
The path of "my.ini" is as shown below in my case:
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
Upvotes: 0
Reputation: 507
This is an old question, but I'm providing an answer that works for current versions of MySQL (based on 5.6.21 and later).
To make passwords work you can't use any of the my.cnf
or my.ini
files, you must use the %APPDATA%\MySQL\.mylogin.cnf
. In addition, you cannot create a plain text file, you have to use the mysql_config_editor
tool to create the file.
For example, say you want to create an automated login for your backup script. First, open a command prompt as the user that will run the job:
runas /user:jobserviceaccount@mydomain cmd
That will open a window running as your job account's user (and create a directory under C:\Users for it).
Next, using the new command window, run the command that will create the .mylogin.cnf
file. For example:
"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql_config_editor" set --user=root --password
In the above example, the tool will prompt you for the password. Type in the password you want, and the file will be created.
Now mysql and mysqldump will use the file you just created as the credentials whenever the account you set it up under is logged in (Task Scheduler can log in a user when it runs a job).
Upvotes: 6
Reputation: 10336
On Windows, MySQL programs read startup options from the following files, in the specified order
Global options (File Name)
The file specified with --defaults-extra-file=path, if any
Login path options
Upvotes: 2