Steps
- Data move කිරීමට අවශ්ය ස්ථානයේ folder එකක් සාදන්න එයට mysql user permission ලබා දෙන්න
- ඉදිරි කටයුතු සදහා දැනට run වෙමින් පවතින MySQL/MariaDB instence එක stop කල යුතුය (Data loss වීම හා damage වීම වලක්වාලීම සදහා )
- ඔබ භාවිතා කරනුයේ MySQL නම් හා OS එක CentOS/Fedora/Redhat නෙවෙයි නම් මෙම command use කරන්න
- # service mysqld stop
- # service mysqld status
- OR
- # service mysql stop
- # service mysql status
- ඊලග පියවරදී , දැනට ඇති data (Excisting data) අලුත් directory එකට මාරු කරන්න (2 වෙනි පියවරේ ඇති directory එකේ සිට අලුත් directory එකට)
- අලුත් directory එක සදහා Database engine එකහි configuration වෙනස් කිරීම
- my.cnf modify කිරීම
[mysqld]
datadir=/mnt/mysql-data/mysql
socket=/mnt/mysql-data/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[client]:
port=3306
socket=/mnt/mysql-data/mysql.sock
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
- SELinux Security Context අලුත් Data Directory සදහා set කිරීම (CentOS/Redhat OS සදහා පමණි )
- semanage fcontext -a -t mysqld_db_t "/mnt/mysql-data(/.*)?"
- restorecon -R /mnt/mysql-data
- අවසන් පියවර , MySQl/MariaDB engine එක නැවත ආරමිභ කරන්න
- Redhat/CentOS
- # systemctl start mariadb
- # systemctl is-active mariadb
- ------------- Ubuntu/MySQL-------------
- # service mysqld start
- # service mysqld status
- OR
- # service mysql start
- # service mysql status
- Verify කිරීම