• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

配置MySQL服务的自启动

mysql 搞代码 4年前 (2022-01-09) 21次浏览 已收录 0个评论

[root@Oracle9i mysql]# cp support-files/mysql.server /etc/init.d/mysql[root@oracle9i mysql]# chmod +x /etc/init.d/mysql[

[root@Oracle9i mysql]# cp support-files/mysql.server /etc/init.d/mysql
[root@oracle9i mysql]# chmod +x /etc/init.d/mysql
[root@oracle9i etc]# chkconfig –list mysql
service mysql s本文来源gaodai$ma#com搞$代*码*网upports chkconfig, but is not referenced in any runlevel (run ‘chkconfig –add mysql’)
[root@oracle9i etc]# chkconfig –add mysql 345 on
chkconfig version 1.3.13.5.EL4 – Copyright (C) 1997-2000 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.

usage: chkconfig –list [name]
chkconfig –add
chkconfig –del
chkconfig [–level ]
[root@oracle9i etc]# chkconfig –add mysql
[root@oracle9i etc]# chkconfig –list mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

重启机器,测试:
[root@oracle9i mysql]# reboot

Broadcast message from root (pts/1) (Wed Mar 2 15:44:42 2011):

The system is going down for reboot NOW!

重启后,发现mysql数据库已经自动启动起来
[root@oracle9i ~]# ps -ef | grep mysql
root 5508 1 0 15:46 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe –datadir=/usr/local/mysql/data –pid-file=/usr/local/mysql/data/oracle9i.pid
mysql 5761 5508 0 15:46 ? 00:00:00 /usr/local/mysql/bin/mysqld –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data –plugin-dir=/usr/local/mysql/lib/plugin –user=mysql –log-error=/usr/local/mysql/data/oracle9i.err –pid-file=/usr/local/mysql/data/oracle9i.pid –socket=/tmp/mysql.sock –port=3306
root 6749 6716 0 15:47 pts/0 00:00:00 grep mysql
[root@oracle9i ~]# mysql -e “select host from db” mysql
+——+
| host |
+——+
| % |
| % |
+——+
[root@oracle9i ~]# mysql -e “show database” mysql
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘database’ at line 1
[root@oracle9i ~]# mysql -e “select host,db,user from db” mysql
+——+———+——+
| host | db | user |
+——+———+——+
| % | test | |
| % | test\_% | |
+——+———+——+


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:配置MySQL服务的自启动
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址