MySQL Forums
Forum List  »  Newbie

Re: where is it and how to move it
Posted by: Barry Galbraith
Date: November 19, 2022 10:45PM


I feel so stupid
No need for that!


According to the config file (as well as @@datadir query) the datadir path is C:\ProgramData\MySQL\MySQL Server 8.0\Data

Then that's where MySQL server will store data for any database(s) you create.
What the actual files are is usually no concern of yours. The form and location of the files can change within the data path with different versions of MySQL.
For MySQL V8.0 the MySQL database is realised in files stored in the <datadir>/sys folder.
Any database you create will have it's files stored in folder that matches the name of your database.

When you say

I can query the database with no problem.
what database is it that you can query? How are you running queries on your database? a good method is with the mysql command line client.

If you want to move the datadir there are several things you must do.
1. Stop the MySQL server.
2. Make the new /data folder to hold all of MySQL databases
3. Copy the existing /data folder to the new location
4. Give the owner of the MySQL service (usually NETWORK SERVICE) read/write privileges to the folder, files, and all subfolders.
5. Change the datadir directive in the my.ini file to point to the new location.
6. Start the MySQL server.

But can I say, it's probably NOT a good idea to make the datadir on a Network Share. Should the network be slow, or the share be (temporarily) unavailable, you are asking for trouble.

Your database can be made available to any/all machines on your network by opening port 3306 on the firewall on the machine where MySQL is running, and provide user logins to MySQL for use from other machines.

You should NEVER consider having 2 or more instances of MySQL sharing the datadir. That way be heartache.

When using your Win10 machine to query your database running on your Win11 machine, you will need something like
>mysql -hLorettasPC -u<win10_user> -p

after creating win10_user in MySQL on your Win11 machine (where MySQL server is running).
If you've installed MySQL on your Win10 machine as well, you won't need it.
You can use Workbench, or MySQL command line client or some other client, to query your database on LorettasPC.

Good luck,

Options: ReplyQuote

Written By
Re: where is it and how to move it
November 19, 2022 10:45PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.