首页 > 解决方案 > mysql安全安装好像不安全

问题描述

成功后mysql_secure_installation

输出:

mysql_secure_installation
Enter current password for root (enter for none): 
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] y
New password:
MyBullPassword
Re-enter new password: 
MyBullPassword
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

当我运行时:

mysql -u root -p

我能够在没有密码甚至密码错误的情况下连接到 mysql,而不是“访问被拒绝”消息,我已连接到 MySQL 服务器。

所以我猜MySQL是不安全的

为什么?我究竟做错了什么?有可能是因为我以 root 身份连接到服务器吗?即使密码错误,mysql也会让我访问?

操作系统:Centos 8 MySQL:MariaDB 10.5.8

标签: mysqldatabase-connectiondatabase-securitymariadb-10.5

解决方案


您必须检查安装中的几件事:

  • 套接字连接 - 它们是启用还是禁用
  • 用户特定的配置my.cnf

有很多信息如何执行这些检查以及如何解决您的问题 - How to disable MySQL root logins when no password is provided?


推荐阅读