在搭建DVWA靶场的时候,总在搭建靶场的最后一步卡住,而导致无法创建数据库,本文将针对两种无法创建数据库的原因进行解决。
1、无法连接数据库报错Database Error#2002
在创建数据库时,显示报错 #2002
Could not connect to the database service.
Please check the config file.
Database Error #2002
1、此时报错为#2002,检查config.inc.php配置文件,端口为3306
2、检查mysql端口号,发现端口号为33306,因为我的主机安装了mysql,为避免端口冲突,自己修改的,此时可发现mysql端口号与DVWA中的端口号不一致
3、修改config.inc.php 端口号与phpstudy中的MYSQL端口号一致
4、重新创建数据库,成功创建
2、无法连接数据库报错Database Error #1045
创建数据库时显示报错 #1045
Could not connect to the database service.
Please check the config file.
Database Error #1045: Access denied for user 'dvwa'@'localhost' (using password: YES).
在创建数据库时,报错
Could not connect to the database service.
Please check the config file.
Database Error #1045: Access denied for user 'dvwa'@'localhost' (using password: YES).
1、检查phpstudy中的数据库密码,为123456
2、检查 config.inc.php 文件,发现配置文件中的密码为“P@ssw0rd”
3、修改 config.inc.php 中的密码,与phpstudy中的一致
4、成功创建数据库,因为我已经初始化一遍,所以页面会有所不同
以上文章为利用phpstudy搭建DVWA靶场所遇到的数据库创建错误 Databases Error #2002、Databases Error # 1045的两种解决办法,这些错误均是 config.inc.php 配置文件与 phpstudy 中的配置不相同而产生的问题。
网安路,任重道远,加油!!!