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

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

Record the problems you solve for others.

Problem Description

The version of MySQL is 5.7 and the operating system is window10. MySQL is installed in C:\Program Files. Recently, you need to add a new configuration item to the my-default.ini configuration file in the MySQL installation directory:

max_allowed_packet=100M

After editing a file, I always fail to save it and get the message "Access Denied".
Later, I stopped the MySQL service, but still could not save the changes.
Then copy my-default.ini to drive D, modify it and save it. Delete the original configuration file under C:\Program Files. Open a command line as an administrator and use the copy command to copy the files to the original location under C:\Program Files. Although the problem of the configuration file not being able to be saved was solved, after restarting the MySQL service, the show variables command showed that the parameters had not been changed.

Workaround

1. Stop the MySQL service.

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

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

4. Copy myini to another disk, such as drive D.

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.

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, start the MySQL service.

think

Win10 restricts files and folders to be modified 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 full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • MySQL configuration file my.cnf parameter optimization and Chinese detailed explanation
  • Detailed explanation of MySQL my.ini configuration file
  • MySQL performance optimization road --- modify the configuration file my.cnf
  • Detailed explanation of MySQL configuration file my.cnf in Chinese, with sharing of MySQL performance optimization methods
  • MySQL optimization configuration file my.ini (discuz forum)
  • MariaDB (MySQL branch) my.cnf configuration file Chinese annotated version
  • Detailed explanation of MySQL configuration file my.cnf optimization (mysql5.5)
  • MySQL 5.5.49 large memory optimization configuration file optimization details
  • MySQL 5.6 & 5.7 Optimal Configuration File Template (my.ini)
  • Comparison of the Chinese version of the MySQL configuration file my.cnf

<<:  jQuery implements clicking left and right buttons to switch pictures

>>:  Detailed explanation of Tomcat's Server Options

Recommend

How to use the Linux nl command

1. Command Introduction nl (Number of Lines) adds...

Nginx implements https website configuration code example

https base port 443. It is used for something cal...

Vue sample code for online preview of office files

I'm working on electronic archives recently, ...

Solution to the failure of loading dynamic library when Linux program is running

Unable to load dynamic library under Linux When t...

A detailed tutorial on how to install Jenkins on Docker for beginners

Jenkins is an open source software project. It is...

Pitfall notes of vuex and pinia in vue3

Table of contents introduce Installation and Usag...

Example of utf8mb4 collation in MySQL

Common utf8mb4 sorting rules in MySQL are: utf8mb...

SASS Style Programming Guide for CSS

As more and more developers use SASS, we need to ...

Detailed explanation of publicPath usage in Webpack

Table of contents output output.path output.publi...

How to configure user role permissions in Jenkins

Jenkins configuration of user role permissions re...

Summary of 6 solutions for implementing singleton mode in JS

Preface Today, I was reviewing the creational pat...

Example analysis of the principle and solution of MySQL sliding order problem

This article uses examples to explain the princip...

No-nonsense quick start React routing development

Install Enter the following command to install it...

MySQL tutorial DML data manipulation language example detailed explanation

Table of contents 1. Data Manipulation Language (...