MySQL 8.4编译安装及小技巧备份中提取单表恢复

设置为服务

程序有给出示例文件,在编译配置时启用了SYSTEMD,会生成在安装目录的usr/lib/systemd/system/目录下。

可以直接使用,也可自行创建:

vim /usr/lib/systemd/system/mysqld.service
# systemd service file for MySQL forking server
[Unit]
Description=MySQL Community Server
After=network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql

Type=forking

LimitNOFILE=50000
LimitNPROC=50000

PIDFile=/data/mysql/mysql.pid

# Disable service start and stop timeout logic of systemd for mysqld service.
TimeoutSec=0

# Execute pre and post scripts as root
PermissionsStartOnly=true

# Start main service
ExecStart=/usr/local/mysql/bin/mysqld --defaults-file=/usr/local/mysql/my.cnf --daemonize $MYSQLD_OPTS
ExecReload=/bin/kill -s HUP $MAINPID

Restart=on-failure
RestartPreventExitStatus=1
PrivateTmp=false
systemctl enable mysqld
systemctl start mysqld
systemctl status mysqld

防火墙规则

firewall-cmd --permanent --add-service=mysql
firewall-cmd --reload

到这里编译安装就结束了。

发表评论

error: Content is protected !!