1.如果你是用yum安装的话就不需要进行设置了 用systemctl restart mysqld启动报如下错:
2.查看系统服务有没有mysqld
chkconfig --list
3.MySQL启动关闭添加到 /etc/init.d/mysqld
cp /data/mysql/support-files/mysql.server /etc/init.d/mysqld ( /data/mysql为安装目录)
4.则按照如下方法安装服务器
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql 将服务文件拷贝到init.d下,并重命名为mysqld
chmod +x /etc/init.d/mysqld 赋予可执行权限
chkconfig --add mysqld 添加服务
chkconfig --list 显示服务列表
5.如下图 如果看到mysql的服务,并且3,4,5都是on的话则成功,如果是off,则键入
6.####重启电脑
reboot
重启之后再看mysql有没自启动成功
输入命令:systemctl status mysqld