安装mysql之前 我想告诉你
在Linux内核当中运行一个进程 一定是以某用户的身份进行运行的
今天 Mysql就是如此 不管 以后是什么服务 都是一样的......
运行环境如下: 非常纯净的系统 什么都没有安装
CentOS 6.4
mysql-5.1.72
检查结果:
[root@LAMP tools]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@LAMP tools]# uname -r
2.6.32-358.el6.x86_64
[root@LAMP tools]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:2F:59:28
inet addr:172.16.30.11 Bcast:172.16.255.255 Mask:255.255.0.0
inet6 addr: fe80::20c:29ff:fe2f:5928/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:368 errors:0 dropped:0 overruns:0 frame:0
TX packets:277 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:34526 (33.7 KiB) TX bytes:37299 (36.4 KiB)
[root@LAMP tools]# hostname
LAMP
1.添加一个系统用户 不创建家目录 不允许用户登录 只是用户运行 mysql这个进程使用
[root@LAMP tools]# useradd -r -s /sbin/nologin mysql
[root@LAMP tools]# id mysql
uid=498(mysql) gid=498(mysql) groups=498(mysql)
[root@LAMP tools]# tail -1 /etc/passwd
mysql:x:498:498::/home/mysql:/sbin/nologin
2.解压 mysql-5.1.72.tar.gz 软件
[root@LAMP tools]# pwd
/root/tools
[root@LAMP tools]# ll
total 31024
-rw-r--r--. 1 root root 1335