- 查看是否存在MySQL組:
- [root@tsxs home]# grep mysql /etc/group
- 不存在創建MySQL組:
- [root@tsxs home]# groupadd mysql
- 查看是否存在MySQL用戶:
- [root@tsxs home]# grep mysql /etc/passwd
- 不存在創建MySQL用戶:
- [root@tsxs ~]# useradd mysql -g mysql -M -s /sbin/nologin
- 檢查:
- [root@tsxs sbin]# grep mysql /etc/passwd
- mysql:x:500:500::/home/mysql:/sbin/nologin
- 使用groups查看用戶mysql所在的組
- [root@tsxs sbin]# groups mysql
- mysql : mysql
注:-g:指定新用戶所屬的用戶組(group); -M:不建立根目錄;-s:定義其使用的shell,/sbin/nologin代表用戶不能登錄系統。
查nginx 可替換命令后面的mysql
參考:https://www.cnblogs.com/zhuiluoyu/p/5453579.html