zabbix the MariaDB database storage location change

#create

mkdir /公司缩写/mysql
 

# Stop the database service

systemctl status mariadb.service
systemctl stop mariadb.service
 

# To move the database files to the new storage location

cp -rp /var/lib/mysql/ /公司缩写/mysql/
 

# Modify the database configuration file

[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
 

# Start the database

systemctl start mariadb.service 
systemctl status mariadb.service
 

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

mysql -uzabbix -p123456 -S /公司缩写/mysql/mysql.sock
 

# Create a soft link, otherwise, zabbix page could not be opened

mkdir /var/lib/mysql
ln -s /公司缩写/mysql/mysql.sock /var/lib/mysql/mysql.sock
 

  In this step before, I was the original / var / lib / mysql directory renamed / var / lib / mysql_ori. So, there will be created / var / lib / mysql command. In the following confirmation zabbix restart the server without problems, web interface can be opened normally. I only original / var / lib / mysql directory to the / tmp directory, and later moved to the company's default directory, as a backup storage.

 

# Restart zabbix

systemctl restart zabbix-server.service
 

References:

http://www.cnblogs.com/seasonsstory/archive/2013/07/24/3209785.html--zabbix Rom database

http://blog.chinaunix.net/uid-20749043-id-1878317.html-- replacement storage path mysql

 

Guess you like

Origin www.cnblogs.com/jianghanyang/p/11102562.html