成功
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甚至在密码错误的情况下也会给我acssess?
操作系统:Centos 8MySQL:MariaDB 10.5.8
您必须检查安装中的一些内容:
- 套接字连接-它们是启用还是禁用
my.cnf
中的用户特定配置
这里有很多关于如何执行这些检查以及如何解决您的问题的信息-如何在没有提供密码的情况下禁用MySQL根登录?