数据库包含具有空用户名和可疑数据库条目的记录
db contains records with empty username and suspicous db entries
我想确保我的 php 网站和登录数据库的用户对 maria 数据库只有强制性权限/特权。
我也想知道
- 如果某些记录可疑或至少是不安全的配置
- 如果建议这样做,如何安全地删除某些记录
记录为
- 来自
mysql.user
条记录User=webphp AND Host=%
- 来自
information_schema.USER_PRIVILEGES
条记录GRANTEE='webphp'@'%'
- 从
mysql.db
记录User="" and host='%'
我的数据库中的记录
mysql.user
SELECT Host, User FROM mysql.user where Host in ('%', '127.0.0.1', '::1', 'localhost');
+-----------+--------+
| Host | User |
+-----------+--------+
| 127.0.0.1 | root |
| ::1 | root |
| localhost | root |
| % | webphp | <-- Can i delete this to avoid connections from outside?
| localhost | webphp |
+-----------+--------+
information_schema.USER_PRIVILEGES
SELECT * FROM information_schema.USER_PRIVILEGES where PRIVILEGE_TYPE = 'USAGE';
+----------------------+---------------+----------------+
| GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE |
+----------------------+---------------+----------------+
| 'webphp'@'localhost' | def | USAGE |
| 'webphp'@'%' | def | USAGE | <-- Can i delete this?
+----------------------+---------------+----------------+
mysql.db
SELECT Host, User, Length(User), Db FROM mysql.db;
+-----------+--------+--------------+---------+
| Host | User | Length(User) | Db |
+-----------+--------+--------------+---------+
| % | | 0 | test | <-- AFAIK i have no Db named test
| % | | 0 | test\_% | <-- same here - Delete?
| localhost | webphp | 6 | webphp |
+-----------+--------+--------------+---------+
来自 MariaDB Server Documentation about mysql.db it is unclear to me if records in mysql.db
should have an empty string "" in the column User
. The docs information-schema-innodb_sys_datafiles-table 如果我可以在这里删除记录,请不要说明。
关于仅授予强制性权利/特权的问题
我打算授予这些权利
GRANT USAGE, SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALTER, CREATE TEMPORARY TABLES
ON *webphp.* TO 'webphp'@localhost IDENTIFIED BY 'mySuperSecretPW';
以上应该确保 user webphp
只能连接到 db webphp
如果他从相同的硬件连接
- 这些权利够吗?我错过了什么吗?
- 这是个好主意吗?
db=test and user =""
的问题
- 我是否应该删除
mysql.db
中字段/列 User
为空的记录?
- 据我所知,我没有名为
test
或 test\_%
的数据库。我可以删除这些记录吗?
db=webphp and user ="webphp"
的问题
information_schema.USER_PRIVILEGES
据我了解 GRANTEE = 'webphp'@'%'
允许用户 webphp 从任何地方连接。如果我的数据库 运行 在同一硬件上,我可以并且应该删除它吗?
mysql.user
我可以删除记录 host=% and user=webphp
以避免被其他服务器使用吗?
GRANT USAGE, SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALTER, CREATE TEMPORARY TABLES
ON *webphp.* TO 'webphp'@localhost IDENTIFIED BY 'mySuperSecretPW';
这些权利够吗?我错过了什么吗?
更具体的数据库名称并使用 webphp.*
。如果确实不需要,请不要给用户 delete
或 alter
权限。如果您的应用程序需要删除内容,则在 table 中有一列标记要删除的内容。
这个主意好吗?
是的。
关于 db=test 和 user =""的问题"
删除不需要的用户和数据库。
information_schema.USER_PRIVILEGES 据我了解 GRANTEE = 'webphp'@'%' 允许用户 webphp 从任何地方连接。如果我的数据库 运行 在同一硬件上,我可以并且应该删除它吗?
是
mysql.user 我可以删除记录 host=% 和 user=webphp 以避免被其他服务器使用吗?
是
我想确保我的 php 网站和登录数据库的用户对 maria 数据库只有强制性权限/特权。 我也想知道
- 如果某些记录可疑或至少是不安全的配置
- 如果建议这样做,如何安全地删除某些记录
记录为
- 来自
mysql.user
条记录User=webphp AND Host=%
- 来自
information_schema.USER_PRIVILEGES
条记录GRANTEE='webphp'@'%'
- 从
mysql.db
记录User="" and host='%'
我的数据库中的记录
mysql.user
SELECT Host, User FROM mysql.user where Host in ('%', '127.0.0.1', '::1', 'localhost');
+-----------+--------+
| Host | User |
+-----------+--------+
| 127.0.0.1 | root |
| ::1 | root |
| localhost | root |
| % | webphp | <-- Can i delete this to avoid connections from outside?
| localhost | webphp |
+-----------+--------+
information_schema.USER_PRIVILEGES
SELECT * FROM information_schema.USER_PRIVILEGES where PRIVILEGE_TYPE = 'USAGE';
+----------------------+---------------+----------------+
| GRANTEE | TABLE_CATALOG | PRIVILEGE_TYPE |
+----------------------+---------------+----------------+
| 'webphp'@'localhost' | def | USAGE |
| 'webphp'@'%' | def | USAGE | <-- Can i delete this?
+----------------------+---------------+----------------+
mysql.db
SELECT Host, User, Length(User), Db FROM mysql.db;
+-----------+--------+--------------+---------+
| Host | User | Length(User) | Db |
+-----------+--------+--------------+---------+
| % | | 0 | test | <-- AFAIK i have no Db named test
| % | | 0 | test\_% | <-- same here - Delete?
| localhost | webphp | 6 | webphp |
+-----------+--------+--------------+---------+
来自 MariaDB Server Documentation about mysql.db it is unclear to me if records in mysql.db
should have an empty string "" in the column User
. The docs information-schema-innodb_sys_datafiles-table 如果我可以在这里删除记录,请不要说明。
关于仅授予强制性权利/特权的问题
我打算授予这些权利
GRANT USAGE, SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALTER, CREATE TEMPORARY TABLES
ON *webphp.* TO 'webphp'@localhost IDENTIFIED BY 'mySuperSecretPW';
以上应该确保 user webphp
只能连接到 db webphp
如果他从相同的硬件连接
- 这些权利够吗?我错过了什么吗?
- 这是个好主意吗?
db=test and user =""
的问题
- 我是否应该删除
mysql.db
中字段/列User
为空的记录? - 据我所知,我没有名为
test
或test\_%
的数据库。我可以删除这些记录吗?
db=webphp and user ="webphp"
的问题
information_schema.USER_PRIVILEGES
据我了解GRANTEE = 'webphp'@'%'
允许用户 webphp 从任何地方连接。如果我的数据库 运行 在同一硬件上,我可以并且应该删除它吗?mysql.user
我可以删除记录host=% and user=webphp
以避免被其他服务器使用吗?
GRANT USAGE, SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALTER, CREATE TEMPORARY TABLES
ON *webphp.* TO 'webphp'@localhost IDENTIFIED BY 'mySuperSecretPW';
这些权利够吗?我错过了什么吗?
更具体的数据库名称并使用 webphp.*
。如果确实不需要,请不要给用户 delete
或 alter
权限。如果您的应用程序需要删除内容,则在 table 中有一列标记要删除的内容。
这个主意好吗?
是的。
关于 db=test 和 user =""的问题"
删除不需要的用户和数据库。
information_schema.USER_PRIVILEGES 据我了解 GRANTEE = 'webphp'@'%' 允许用户 webphp 从任何地方连接。如果我的数据库 运行 在同一硬件上,我可以并且应该删除它吗?
是
mysql.user 我可以删除记录 host=% 和 user=webphp 以避免被其他服务器使用吗?
是