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 version		5.5.31-0+wheezy1
Protocol version	10
Connection		Localhost 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

posted on 2013-05-23 10:40  Milton  阅读(273)  评论(0编辑  收藏  举报

导航