一,数据库MySQL用户limit限制设置。
1.
创建MySQL的用户组和用户(一般在建立mysql软件时添加,这里是再次复习相关知识)
[
root@localhost cmake-3.0.1]# groupadd mysql
[
root@localhost cmake-3.0.1]# useradd -g mysql mysql
2.
设置用户操作系统资源的限制
[
root@localhost cmake-3.0.1]# vi /etc/security/limits.conf
mysql soft nproc 2047
mysql hard nproc 16384
mysql soft nofile 2047
mysql hard nofile 65536
3.
验证limit是否生效
[
mysql@localhost ~]$ ulimit -a
open files (-n) 2047 (与nofile的配置大小有关)
max user processes (-u) 2047
二,数据库用户安全配置
配置数据库(账号,安全方面)
(
root@localhost) [(none)]> select user,host from mysql.user;
+------+-----------------------+
| user | host |
+------+-----------------------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| | localhost.localdomain |
| root | localhost.localdomain |
+------+-----------------------+
6 rows in set (0.00 sec)
删除不安全的用户
(
root@localhost) [(none)]>delete from mysql.user where (user,host) not in(select 'root','localhost');
修改用户名字
(
root@localhost) [(none)]>update mysql.user set user='system',password=password('zsd0123');
删除test数据库的权限功能
(
root@localhost) [(none)]>truncate table mysql.db;
最后生效上述的操作
(
root@localhost) [(none)]>flush privileges;
用户登录
[
mysql@localhost 3306]$ mysql -u'system' -p'zsd0123'
再次查看数据库用户
+--------+-----------+
| user | host |
+--------+-----------+
| system | localhost |
+--------+-----------+
1 row in set (0.01 sec)
阅读(2157) | 评论(0) | 转发(0) |