where is mysql server's default data folder in windows 7
I am looking for the data directory of mysql server (5.1.42) I installed on my machine which runs win7.
There is no 'data' direcotory in C:\Program Files\MySQL\MySQL Server 5.1 and also in C:\U开发者_运维百科sers\MyAccount\AppData\Local||LocalLow||Roaming
Different MySQL/Windows versions have different data folder locations. To get your ACTUAL data folder location just execute this SQL:
SHOW VARIABLES WHERE Variable_name LIKE '%dir'
Must be C:\ProgramData\MySQL\MySQL Server 5.1\data.
Was not really a good idea to place data here by default. It is compatible with various Vista compatibility requirements, but is eather hard to find, especially given the ProgramData folder is hidden.
You can find the data directory at this location
C:\ProgramData\MySQL\MySQL Server 5.5\data\<YourDataDirectory\TableName.frm>
The path can be defined in my.ini
(located in Windows directory) as datadir
.
I have had the problem to find the data directory too and even to start the mysql the second time after installing the server 5.7 on Windows 7.
In contrary to some answers here and to the documentation (the part about location of my.ini), the my.ini location was c:\ProgramData\MySQL\MySQL Server 5.7\my.ini the data location was c:\ProgramData\MySQL\MySQL Server 5.7\Data. In fact it was to see, as default proposed data location, during the installation.
This is what worked for me on Windows 7:
c:\ProgramData\MySQL\MySql Server 5.7> xcopy data c:\MySQL\"MySQL Server 5.7"\data\
After that, run MySQL server with:
c:\MySQL\"MySQL Server 5.7"\bin> mysqld
Thanks to those who shared the information that C:\ProgramData
was a hidden directory!
If you installed mysql with the MSI installer,
look here: C:\ProgramData\MySQL\MySQL Server 5.7\
and you should see the data folder.
Even thought my datadir
is specified to be located in the default mysql server
location, my data is stored in %ProgramData%
.
Windows version independent answer.
For MySQL 5.7
on Windows, directory for log files and databases is
"%PROGRAMDATA%\MySQL\MySQL Server 5.7\"
The Windows system variable
%PROGRAMDATA%
defaults to C:\ProgramData
source: https://dev.mysql.com/doc/refman/5.7/en/windows-installation-layout.html
After changing the directory, the root password is reset. So, keep in mind, if you change the directory, and have access issues, try to access it without a password then set a new password.
For newer users: The data directory lies in C:\Program Files\MySQL\MySQL Server 8.0\data
I currently have MySQL Server 8.0. If you too, are searching for some error solutions and couldn't find the "data" directory for MySQL, here's a note from the official MySQL:
"The default data directory location is
C:\Program Files\MySQL\MySQL Server 8.0\data
, orC:\ProgramData\Mysql
on Windows 7 and Windows Server 2008. TheC:\ProgramData
directory is hidden by default. You need to change your folder options to see the directory and contents."
Hope this clears some hurdles
Take a look at:
C:\Users\All Users\MySQL\MySQL Server 5.1\data
精彩评论