# Mysql Data store folder change

**URL:** <https://forums.percona.com/t/mysql-data-store-folder-change/1893>\
**Category:** Other MySQL® Questions\
**Created:** [September 11, 2012, 6:38am UTC](https://forums.percona.com/t/mysql-data-store-folder-change/1893 "2012-09-11T06:38:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![roni](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/roni/32/890_2.png) [@roni](https://forums.percona.com/u/roni)\
**Post date:** [September 11, 2012, 6:38am UTC](https://forums.percona.com/t/mysql-data-store-folder-change/1893/1 "2012-09-11T06:38:46Z")

</div>

I have installed Percona mysql in my ubuntu server successfully. I need to move percona data location from /var/lib/mysql to /mysql-data directory.Because /mysql-data directory is encrypted volume.How to move percona data folder into this location

---

<div class="post-metadata">

**Author:** ![przemek](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/przemek/32/3_2.png) [@przemek](https://forums.percona.com/u/przemek)\
**Post date:** [September 11, 2012, 12:36pm UTC](https://forums.percona.com/t/mysql-data-store-folder-change/1893/2 "2012-09-11T12:36:46Z")

</div>

- stop mysql server
- change the /mysql-data directory owner and group to the same as /var/lib/mysql, and to the same chmod
- copy the data files and directories to the new directory (including the /var/lib/mysql/mysql directory)
- make sure the rights on destination directory/files are correct again
- add  
datadir = /mysql-data  
to your mysql config
- restart the server

---

<div class="post-metadata">

**Author:** ![roni](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/roni/32/890_2.png) [@roni](https://forums.percona.com/u/roni)\
**Post date:** [September 11, 2012, 9:53pm UTC](https://forums.percona.com/t/mysql-data-store-folder-change/1893/3 "2012-09-11T21:53:20Z")

</div>

Thanks  
Its works

---

<div class="post-metadata">

**Author:** ![prince85](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@prince85](https://forums.percona.com/u/prince85)\
**Post date:** [February 15, 2019, 7:31am UTC](https://forums.percona.com/t/mysql-data-store-folder-change/1893/4 "2019-02-15T07:31:24Z")

</div>

While I’m having the same permission to the new dir still couldn’t start the mysql.

[root@ip-10-99-10-103 mysql]# ls -ltr /data/  
total 20  
drwx------. 2 root root 16384 Feb 14 15:14 lost+found  
drwxr-xr-x. 5 mysql mysql 4096 Feb 14 17:48 mysql

[root@ip-10-99-10-103 mysql]# ls -ltr /var/lib/ |grep mysql  
drwxr-x—. 2 mysql mysql 6 Dec 18 17:35 mysql-keyring  
drwxr-x—. 2 mysql mysql 6 Feb 14 17:48 mysql-files  
drwxr-x–x. 5 mysql mysql 4096 Feb 15 12:36 mysql

---

<div class="post-metadata">

**Author:** ![przemek](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/przemek/32/3_2.png) [@przemek](https://forums.percona.com/u/przemek)\
**Post date:** [February 17, 2019, 8:10am UTC](https://forums.percona.com/t/mysql-data-store-folder-change/1893/5 "2019-02-17T08:10:56Z")

</div>

Check if you have SElinux enabled.
