Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Change the storage location of zabbix's MariaDB database

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

# create

Mkdir / company abbreviation / mysql

# stop database service

Systemctl status mariadb.servicesystemctl stop mariadb.service

# move database files to a new storage location

Cp-rp / var/lib/mysql/ / Company abbreviation / mysql/

# modified database configuration file

[root@iZkdZ ~] # cat / etc/ my.cnf [mysqld] datadir=/ acronym / mysqlsocket=/ acronym / mysql/mysql.socklower_case_table_names = Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-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.logpid-file=/var/run/mariadb/mariadb.pid## include all files from the config directory#!includedir / etc/my.cnf.d

# start the database

Systemctl start mariadb.service systemctl status mariadb.service

# New command to log in to the database, you need to specify mysql.sock

Mysql-uzabbix-p123456-S / Company acronym / mysql/mysql.sock

# create a soft link, otherwise the zabbix page cannot be opened

Mkdir / var/lib/mysqlln-s / company abbreviation / mysql/mysql.sock / var/lib/mysql/mysql.sock

Before this step, I renamed the original / var/lib/mysql directory to / var/lib/mysql_ori. So, there will be a command to create / var/lib/mysql. Confirm below that there is no problem with restarting the zabbix server, and the web interface can be opened normally. I just moved the original / var/lib/mysql directory to the / tmp directory, and then to the company's default directory for backup.

# restart zabbix

Systemctl restart zabbix-server.service

Reference:

Http://www.cnblogs.com/seasonsstory/archive/2013/07/24/3209785.html--zabbix cannot connect to the database

Http://blog.chinaunix.net/uid-20749043-id-1878317.html-- change mysql storage path

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report