Can I share MySql database files with Windows on dual boot?
Yes, it works but with some quirks. MySQL uses the same fileformats across platforms so all you need is to share the data directory. One problem is that the data directory need to have mysql as owner and group in ubuntu. And Windows is case-insensitive and Linux is case-sensitive so keep all names uniform: either the whole name lowercase or uppercase but do not mix them.
From start to finish; if you already have things set up this might need some tweaking to fit your setup:
- Install and setup MySQL on both systems.
- Stop the mysql server if it is running.
- Make a new NTFS partition. Mark the device name (let's call it
sdXN
for now). Move the mysql data directory from Ubuntu to the new partition.
mkdir /{mountpoint}/mysql_data sudo mv /var/lib/mysql /{mountpoint/mysql_data
using
mv
saves permissions.Make a new mysql directory
sudo mkdir /var/lib/mysql
Mount the NTFS partition at
/var/lib/mysql
. Change the devicename to what it got when you created the NTFS partition.sudo mount /dev/{sdXN} /var/lib/mysql -t ntfs-3g -o uid=mysql,gid=mysql,umask=0077
To automount on boot find the partition UUID and locale and edit
/etc/fstab
.ls -l /dev/disk/by-uuid locale -a sudo gedit /etc/fstab UUID={number_found_with_the_ls-l} /var/lib/mysql ntfs-3g uid=mysql,gid=mysql,umask=0077,locale={your_locale}.utf8 0 0
Change the 'datadir' path in
/etc/mysql/my.cnf
to point to/var/lib/mysql/mysql_data
Start the mysql server and test it.
Edit the Windows config file (
my.ini
) and set 'datadir' toX:/mysql_data
(replaceX:
for where you mount it under Windows).
Compiled from topic 1442148 on UF.org.
I got the Ubuntu version working; so partly untested since I do not have Windows