Home  >  Article  >  Database  >  Detailed solution to the problem that the MySQL configuration file cannot be modified (Win10)

Detailed solution to the problem that the MySQL configuration file cannot be modified (Win10)

黄舟
黄舟Original
2017-03-28 13:33:551318browse

This article mainly introduces the MySQL configuration file to the solution that cannot be modified. It has certain reference value. Interested friends can refer to it

Record the problems you help others solve.

Problem description

MySQL version is 5.7, and the operating system is window10. MySQL is installed under C:\Program Files. Recently, a new configuration item needs to be added to the my-default.ini configuration file in the MySQL installation directory:

max_allowed_packet=100M

Edit file After saving, it always fails to save and prompts "Access Denied".
Later, I stopped the MySQL service and still could not save the changes.
Later, copy my-default.ini to the D drive, modify it and save it. Delete the original configuration file under C:\Program Files. Open the command line as an administrator and use the copy command to copy to the original location under C:\Program Files. Although the problem that the configuration file cannot be saved has been solved, after restarting the MySQL service, the show variables command can see that the parameters have not been changed.

Solution

1. Stop the MySQL service.

2. Open the file browser. File -> Change folder and Search options -> "View" tab -> Remove all options for hidden files and folders.

3. You can now see the hidden folder C:\ProgramData\MySQL\MySQL Server 5.7. There is a my.ini configuration file in this folder. MySQL reads this configuration file by default.

4. Copy myini to other disks, such as D disk.

5, modify D:\my.ini and save. Note: max_allowed_packet=100M should be placed under the [mysqld] configuration section. You can search for this parameter first. If the system already has it, just change the number directly.

6. Delete my.ini in the original installation directory as an administrator.

7. Open the start menu, right-click on the command line menu item -> Run as administrator. Execute the command:

copy "D:\my.ini" "C:\ProgramData\MySQL\MySQL Server 5.7"

Seventh, open the MySQL service.

Thinking

win10 restricts modifications to files and folders only with administrator privileges. So use this command line to solve the problem. At the same time, MySQL reads the my.ini configuration file under C:\ProgramData\MySQL\MySQL Server 5.7 by default.

The above is the detailed content of Detailed solution to the problem that the MySQL configuration file cannot be modified (Win10). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn