debian 7 mysql_Debian 7 Wheezy 安装 MySQL5

安装很简单

sudo apt-get install mysql-server

系统会提示需要安装其他的几个包, libaio1 libdbd-mysql-perl libdbi-perl

libhtml-template-perl libmysqlclient18 libnet-daemon-perl libplrpc-perl

mysql-client-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5

在界面提示输入mysql的root用户密码并确认后, 安装就完成了.

安装之后mysql的系统服务就自动启动了, 可以通过sudo service mysql status查看服务状态. 这个状态显示比较牛逼…

[info] /usr/bin/mysqladmin Ver 8.42 Distrib 5.5.31, for debian-linux-gnu on x86_64

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.

Server version5.5.31-0+wheezy1

Protocol version10

ConnectionLocalhost via UNIX socket

UNIX socket/var/run/mysqld/mysqld.sock

Uptime:1 min 13 sec

Threads: 1 Questions: 574 Slow queries: 0 Opens: 445 Flush tables: 2 Open tables: 41 Queries per second avg: 7.863.

配置mysql不要开机自启动, 通过$ ll /etc/rc?.d/*mysql 查看mysql在各个level的启动状态:

lrwxrwxrwx 1 root root 15 May 25 10:28 /etc/rc0.d/K02mysql -> ../init.d/mysql

lrwxrwxrwx 1 root root 15 May 25 10:28 /etc/rc1.d/K02mysql -> ../init.d/mysql

lrwxrwxrwx 1 root root 15 May 25 10:28 /etc/rc2.d/S17mysql -> ../init.d/mysql

lrwxrwxrwx 1 root root 15 May 25 10:28 /etc/rc3.d/S17mysql -> ../init.d/mysql

lrwxrwxrwx 1 root root 15 May 25 10:28 /etc/rc4.d/S17mysql -> ../init.d/mysql

lrwxrwxrwx 1 root root 15 May 25 10:28 /etc/rc5.d/S17mysql -> ../init.d/mysql

lrwxrwxrwx 1 root root 15 May 25 10:28 /etc/rc6.d/K02mysql -> ../init.d/mysql

可以看到在状态0, 1, 6中是关闭, 在2, 3, 4, 5中是启动

将mysql移出开机自启动:

删除自启动服务用的命令是 update-rc.d -f mysql remove

添加自启动服务用的命令是 update-rc.d mysql defaults

自定义启动级别的命令是 update-rc.d mysql start 20 2 3 4 5 . stop 80 0 1 6 , 会得到类似以下的结果(把tomcat6换成mysql):

Adding system startup for /etc/init.d/tomcat6 …

/etc/rc0.d/K80apache2 -> ../init.d/tomcat6

/etc/rc1.d/K80apache2 -> ../init.d/tomcat6

/etc/rc6.d/K80apache2 -> ../init.d/tomcat6

/etc/rc2.d/S20apache2 -> ../init.d/tomcat6

/etc/rc3.d/S20apache2 -> ../init.d/tomcat6

/etc/rc4.d/S20apache2 -> ../init.d/tomcat6

/etc/rc5.d/S20apache2 -> ../init.d/tomcat6

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值