Home > Database > Mysql Tutorial > How to modify the MySQL data storage path

How to modify the MySQL data storage path

王林
Release: 2023-05-26 13:46:28
forward
4061 people have browsed it

    1. View the original path

    ◼ Open MySQL 8.0 Command Line Client

    ◼ Entershow variables like '�tadir %'; (The semicolon cannot be lost)

    How to modify the MySQL data storage path

    2. Stop MySQL

    (1)Method 1:

    ◼ 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

    How to modify the MySQL data storage path

    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.

    How to modify the MySQL data storage path

    (2) Method 2:

    Stop MySQL directly in the service

    How to modify the MySQL data storage path

    How to modify the MySQL data storage path

    3. Modify the path

    (1) Find my.ini

    ◼ You can find the Data folder through the path viewed in the first step , my.ini is in the same directory as Data

    How to modify the MySQL data storage path

    (2) Modify my.ini

    ◼ 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→

    How to modify the MySQL data storage path

    ◼ 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

    How to modify the MySQL data storage path

    ◼ Finally, put the Data folder under the original path Copy the entire thing to the target path, and that’s it

    How to modify the MySQL data storage path

    4. Restart MySQL

    ◼ The method is the same as stopping MySQL

    ◼ Method Just modify the inputnet start MySQL80

    How to modify the MySQL data storage path

    5. Check the path again

    ◼ 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)

    How to modify the MySQL data storage path

    ◼ 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!

    Related labels:
    source:yisu.com
    Statement of this Website
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template