本篇文章小编给大家分享一下mysql5.7单实例自启动服务配置代码过程,文章代码介绍的很详细,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
1.mysql版本
[root@clq system]# mysql -v Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 49 Server version: 5.7.33 MySQL Community Server (GPL)
2.配置mysqld.service文件
[Unit] Description=mysql server daemon After=network.target mysql-keygen.target [Service] Type=forking ExecStart=/usr/local/mysql/support-files/mysql.server start ExecStop=/usr/local/mysql/support-files/mysql.server stop ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target [Install] WantedBy=multi-user.target
3.mysqld.service文件放置的地方
/usr/lib/systemd/system/mysqld.service
4.自启动
systemctl daemon-reload systemctl enable --now mysqld [root@mysql ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:111 0.0.0.0:* LISTEN 0 32 192.168.122.1:53 0.0.0.0:* LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 5 127.0.0.1:631 0.0.0.0:* LISTEN 0 128 [::]:111 [::]:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 5 [::1]:631 [::]:* LISTEN 0 80 *:3306 *:*