1

I am changing the 'data' folder on my mysql server via the .ini file or via the MySQL Benchmark software (it basically does the same thing). Both data folders are identical. Is there anything else I want to keep in mind when changing the route to the data folder?

The error logs are empty which is really odd for me. The error I get in the shell when net start mysql56 is Unexpected error which doesn't give me much information.

I use Windows 7 64 Bit. And my MySQL version is 5.6.

I am changing the roots from

 C:/ProgramData/MySQL/MySQL Server 5.6/Data

to

 E:/Server/Data
OurBG
  • 507
  • 1
  • 8
  • 22
  • I had a similar issue. There is more that you need to do to accomplish this. Can you state the error you get and what your OS is? – dan b Dec 23 '14 at 10:13
  • Here is a link to the same question. http://stackoverflow.com/q/1795176/4350148. Do you agree this is a duplicate of that question? – dan b Dec 23 '14 at 10:16
  • I edited my post with more information. None of the solutions in the other thread (or in the two-day Google research) seem to not be helpful to me. I thought more personalized advice will be better. – OurBG Dec 23 '14 at 16:15

1 Answers1

1

I'm using Ubuntu 16.04.

Maybe things have been changed so I may post the solution I found here.

$ sudo -i

# /etc/init.d/mysql stop

# cp -R -p /var/lib/mysql [new_path]

# emacs -nw /etc/mysql/mysql.conf.d/mysqld.cnf

change the line
        datadir = /var/lib/mysql
to
        datadir = [new_path]/mysql

# emacs -nw /etc/apparmor.d/usr.sbin.mysqld

change the lines
        /var/lib/mysql/ r,
        /var/lib/mysql/** rwk,
to
        #/var/lib/mysql/ r,
        #/var/lib/mysql/** rwk,
        [new_path]/mysql/ r,
        [new_path]/mysql/** rwk,

# /etc/init.d/apparmor reload
# /etc/init.d/mysql restart

It works for me a Ubuntu 16.04 user.

Hope it also works for others!

ghchoi
  • 4,812
  • 4
  • 30
  • 53
  • Thanks for mentioning the AppArmor, it saved me some time! Also it is worth reminding (where I spent unnecessary time myself) to make sure that mysql user has rights to navigate all the way on the `[new_path]` -- my new datadir folder had an ancestor that only I was able to read. It was very frustrating trying out all options before testing sth as trivial as trying to `cd`ing into the folder as mysql... – wojtuch Nov 03 '16 at 11:29