linux 添加 msyql 开机自启动

1、将服务文件拷贝到init.d下,并重命名为mysql

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

2、赋予可执行权限

chmod +x /etc/init.d/mysqld

3、添加服务

chkconfig --add mysqld

4、显示服务列表

chkconfig --list

如果看到mysql的服务,并且3,4,5都是on的话则成功,如果是off,则键入

chkconfig --level 345 mysqld on

5、重启电脑

reboot

6、验证

netstat -na | grep 3306

有监听说明服务启动了

本文转自:https://www.cnblogs.com/sunny3096/p/7954146.html

更详细解说:https://blog.csdn.net/mrqiang9001/article/details/80295261

原文地址:https://www.cnblogs.com/xiaobaiskill/p/9648025.html