您好,登錄后才能下訂單哦!
#創(chuàng)建
mkdir /公司縮寫/mysql
#停止數(shù)據(jù)庫服務(wù)
systemctl status mariadb.service systemctl stop mariadb.service
#把數(shù)據(jù)庫文件移動到新的存儲位置
cp -rp /var/lib/mysql/ /公司縮寫/mysql/
#修改后的數(shù)據(jù)庫配置文件
[root@iZkdZ ~]# cat /etc/my.cnf [mysqld] datadir=/公司縮寫/mysql socket=/公司縮寫/mysql/mysql.sock lower_case_table_names = 1 # 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 [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
#啟動數(shù)據(jù)庫
systemctl start mariadb.service systemctl status mariadb.service
#新的登錄數(shù)據(jù)庫的命令,需要指定mysql.sock
mysql -uzabbix -p123456 -S /公司縮寫/mysql/mysql.sock
#創(chuàng)建軟鏈接,否則,zabbix頁面無法打開
mkdir /var/lib/mysql ln -s /公司縮寫/mysql/mysql.sock /var/lib/mysql/mysql.sock
在這一步之前,我是把原始的/var/lib/mysql目錄改名為/var/lib/mysql_ori。所以,會有創(chuàng)建/var/lib/mysql的命令。在下面確認(rèn)重啟zabbix服務(wù)端沒有問題,web界面可以正常打開。我才把原始的/var/lib/mysql目錄移動到/tmp目錄,后來又移動到公司默認(rèn)的目錄,作為備份存放。
#重啟zabbix
systemctl restart zabbix-server.service
參考資料:
http://www.cnblogs.com/seasonsstory/archive/2013/07/24/3209785.html——zabbix連不上數(shù)據(jù)庫
http://blog.chinaunix.net/uid-20749043-id-1878317.html——更換mysql存儲路徑
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。