mysql开机启动配置_mysql配置开机启动

配置/etc/rc.local 将mysql设置为开机启动

方法一、

[root@dataserver ~]# vim /etc/rc.local#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don‘t

# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

/etc/init.d/mysqld start

~

~

~

~

"/etc/rc.local" 8L, 245C 已写入

[root@dataserver ~]# reboot

[root@dataserver ~]# ss -lntup|grep mysql

tcp    LISTEN     0      50                     *:3306                  *:*      users:(("mysqld",1459,10))

方法二、

[root@dataserver ~]chkconfig --add mysqld

[root@dataserver ~]chkconfig mysqld on

[root@dataserver ~]reboot

重启查看是否生效

[root@dataserver ~]# reboot

Broadcast message from root@dataserver

(/dev/pts/1) at 5:26 ...

The system is going down for reboot NOW!

[root@dataserver ~]#

Last login: Wed Sep 27 05:21:53 2017 from 192.168.3.3

[root@dataserver ~]# ss -lntup|grep mysql

tcp    LISTEN     0      50                     *:3306                  *:*      users:(("mysqld",1459,10))

[root@dataserver ~]# mysql -uroot -pdongliqiang

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.5.32 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| dongliqiang        |

| mysql              |

| performance_schema |

| test               |

+--------------------+

5 rows in set (0.06 sec)

开机启动还有其他种方法,大家自行尝试,掌握最常用的集中就行了

本文出自 “董利强” 博客,请务必保留此出处http://6207422.blog.51cto.com/6197422/1968970

mysql配置开机启动

标签:mysql自启动

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:http://6207422.blog.51cto.com/6197422/1968970

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值