Is it possible to change my default MySQL data directory to another path? Will I be able to access the databases from the old location?
相关问题
- sqlyog export query result as csv
- How to access the camera from my Windows Phone 8 a
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Why sometimes there is one of more gap(s) in the v
Everything as @user1341296 said, plus...
You better not to change
/etc/mysql/my.cnf
Instead you want to create new file/etc/mysql/conf.d/ext.cnf
(any name, but extension should becnf
)And put in it your change:
In this way
I often need to do this when upgrading machines, moving from box to box. In addition to moving /var/lib/mysql to a better location, I often need to restore old DB tables from an old MySQL installation. In order to do this...
For one of the environment I changed mysql data directory to new location but during restart of mysql server, it was taking time. So I checked the port, and found that other process was listening on mysql port. So I killed the process and restarted mysql server and it worked well.
I followed below steps for changing data directory which worked excellent. change mysql data directory in Linux
First , you should know where is your config file ? where is your config file ?
IF you installed with apt-get or yum install 。
config file may appear in
datafile may appear in
and what you should do is
and then jobs done.
But if you didn't install it with apt or yum,the direcotry may not like this ,and you can find the mysql files with
This solution works in Windows 7 using Workbench. You will need Administrator privileges to do this. It creates a junction (like a shortcut) to wherever you really want to store your data
Open Workbench and select INSTANCE - Startup / Shutdown Stop the server
Install Junction Master from https://bitsum.com/junctionmaster.php
Navigate to C:\ProgramData\MySQL\MySQL Server 5.6
Right click on Data and select "MOVE and then LINK folder to ..." Accept the warning Point destination to "Your new data directory here without the quotes" Click MOVE AND LINK
Now go to "Your new data directory here without the quotes"
Right click on Data Go to the security tab Click Edit Click Add Type NETWORK SERVICE then Check Names Click OK Click the Allow Full Control checkbox and then OK
Go back to Workbench and Start the server
This method worked for me using MySQL Workbench 6.2 on Windows 7 Enterprise.
If like me you are on debian and you want to move the mysql dir to your home or a path on /home/..., the solution is :
One day to find the solution for me on the mariadb documentation. Hope this help some guys!