CentOS7 MySQL / Redis 开机启动

CentOS7

MySQL开机启动

#设置为linux系统服务
[root@localhost ~]# cp /usr/local/mysql-5.7.26/support-files/mysql.server /etc/init.d/mysqld
#给执行权限
[root@localhost ~]# chmod +x /etc/init.d/mysqld
#设置开机自启
[root@localhost ~]# systemctl enable mysqld
#查看启动状态
[root@localhost ~]# systemctl status mysqld

Redis开机启动

修改:utils/redis_init_script

REDISPORT=6379
#修改当前Reids目录 /home/redis-5.0.5
EXEC=/home/redis-5.0.5/src/redis-server
CLIEXEC=/home/redis-5.0.5/src/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
#端口号命名的配置文件
CONF="/etc/redis/${REDISPORT}.conf"
#设置为linux系统服务  /etc/init.d/redisd 命名为 redisd 
[root@localhost ~]# cp /home/redis-5.0.5/utils/redis_init_script /etc/init.d/redisd
#给执行权限
[root@localhost ~]# chmod +x /etc/init.d/redisd
#设置开机自启
[root@localhost ~]# systemctl enable redisd
#查看启动状态
[root@localhost ~]# systemctl status redisd

你可能感兴趣的:(CentOS7 MySQL / Redis 开机启动)