Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Sunday, April 16, 2017

Changing the default MySQL/MariaDB Data Directory

සුභ දවසක් , අද මම කියලා දෙන්න යන්නේ කොහොමද MySQL/MariaDB වල default data saving directory එක change කරගන්න විදිය.ගොඩක් වෙලාවට HDD එකේ space අඩුවුණාම අපිට මේ විදියට data saving location එක වෙනස් කරන්න වෙනවා

Steps


  • Data move කිරීමට අවශ්‍ය ස්ථානයේ folder එකක් සාදන්න එයට mysql user permission ලබා දෙන්න


  • දැනට භාවිතා කරන MySQL directory එක බලාගැනීමට පහත command එක enter කරන්න


  • ඉදිරි කටයුතු සදහා දැනට 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 කිරීම



Read More

Install MySQL/MariaDB in Linux


සුභ දවසක් ඔයාලට , අද මම කියල දෙන්න යන්නේ Linux OS එකට MySQL හෝ MariaDB install කරගන්න විදිය ගැන.

MySQL හා MariaDB යනු දැනට ලෝකයේ බහුලව භාවිතා වෙන Database වර්ග 2ක් වන අතර, මෙම database 2කිම එකම Core ක් යටතේ develop කරන ලද database engine වේ , MySQL යනු Oracle සමගම යටතේ නිකුත් කරන Free database engine (Closed Source) එකක් MariaDB යනු නිදහස් මෘදුකාංග යටතේ නිකුත් කරන database engine එකකි (Free Open Source).

Read More
SITTHAMA

Sinhala Support


Followers

Designed By Seo Blogger Templates