◼ Open MySQL 8.0 Command Line Client
◼ Entershow variables like '�tadir %';
(The semicolon cannot be lost)
◼ Run command prompt as administrator
win R → Enter cmd → ctrl shift enter
or
in the taskbar Search for "Command Prompt" in the search box, then right-click and select Run as administrator
◼ Enter net stop MySQL80
Note: Here, MySQL80 is the name of the server. Different versions may be different. The illustration shows version 8.0, which corresponds to 80 (default). MySQL can be either uppercase or lowercase, including mysql80.
◼ Stop MySQL directly in the service
◼ You can find the Data folder through the path viewed in the first step , my.ini is in the same directory as Data
◼ You may encounter unauthorized modifications. You can modify the permissions of my.ini first. You can modify the relevant permissions by:Right-click my.ini → Properties→ Security→ Edit→
◼ If there is no above situation, open it directly my.ini and find the datadir.
◼ Use ’ # ' to comment the original code# datadir=C:/ProgramData/MySQL/MySQL Server 8.0/Data
◼ Write your target pathdatadir=..........
(Note that ’ / ’ must be used here, not ’ \ ', otherwise it may fail, remember to save!!)
◼ Here I put it in a newly created MySQL Server 8.0 folder on the E drive
◼ Finally, put the Data folder under the original path Copy the entire thing to the target path, and that’s it
◼ The method is the same as stopping MySQL
◼ Method Just modify the inputnet start MySQL80
◼ Check the path to see if the modification is successful No
◼ Open MySQL 8.0 Command Line Client
◼ Entershow variables like '�tadir%';
(the semicolon cannot be lost)
◼ Modification successful
The above is the detailed content of How to modify the MySQL data storage path. For more information, please follow other related articles on the PHP Chinese website!