首先执行命令Setup/reset Database for labs时,mysqlsql时报错:
SETTING UP THE DATABASE SCHEMA AND POPULATING DATA IN TABLES:
Warning: mysql_connect(): Server sent charset (255) unknown to the client. Please, report to the developers in D:\develop\networkSecurity\phpStudy\PHPTutorial\WWW\sqli-labs\sql-connections\setup-db.php on line 29
Warning: mysql_connect(): Server sent charset unknown to the client. Please, report to the developers in D:\develop\networkSecurity\phpStudy\PHPTutorial\WWW\sqli-labs\sql-connections\setup-db.php on line 29
[*]...................Could not connect to DB, check the creds in db-creds.inc: Server sent charset unknown to the client. Please, report to the developers
由错误可知是mysql 8的编码问题。
解决为修改mysql编码为utf8:
1、打卡mysql 8安装目录下的data文件夹,找到my.ini
2、修改两处my.ini中的配置:
character-set-server= utf8
default-character-set=utf8
重启mysql,然后再次执行Setup/reset Database for labs,还是报错:
SETTING UP THE DATABASE SCHEMA AND POPULATING DATA IN TABLES:
Warning: mysql_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in D:\develop\networkSecurity\phpStudy\PHPTutorial\WWW\sqli-labs\sql-connections\setup-db.php on line 29
Warning: mysql_query(): MySQL server has gone away in D:\develop\networkSecurity\phpStudy\PHPTutorial\WWW\sqli-labs\sql-connections\setup-db.php on line 42
Warning: mysql_query(): Error reading result set's header in D:\develop\networkSecurity\phpStudy\PHPTutorial\WWW\sqli-labs\sql-connections\setup-db.php on line 42
[*]...................Error purging database: MySQL server has gone away
[*]...................Error creating database: MySQL server has gone away
[*]...................Error creating Table: MySQL server has gone away
[*]...................Error creating Table: MySQL server has gone away
[*]...................Error creating Table: MySQL server has gone away
[*]...................Error creating Table: MySQL server has gone away
[*]...................Error inserting data: MySQL server has gone away
[*]...................Error inserting data: MySQL server has gone away
[*]...................Error purging database: MySQL server has gone away
[*]...................Error creating database: MySQL server has gone away
Unable to connect to the database: challengesMySQL server has gone away
着重看标红的地方,授权有问题。
解决办法还是修改my.ini配置文件:
default_authentication_plugin=mysql_native_password
再次重启mysql8并执行Setup/reset Database for labs,可以看到数据库已经创建成功了:文章来源:https://www.toymoban.com/news/detail-709263.html
SETTING UP THE DATABASE SCHEMA AND POPULATING DATA IN TABLES:
[*]...................Old database 'SECURITY' purged if exists
[*]...................Creating New database 'SECURITY' successfully
[*]...................Creating New Table 'USERS' successfully
[*]...................Creating New Table 'EMAILS' successfully
[*]...................Creating New Table 'UAGENTS' successfully
[*]...................Creating New Table 'REFERERS' successfully
[*]...................Inserted data correctly into table 'USERS'
[*]...................Inserted data correctly into table 'EMAILS'
[*]...................Old database purged if exists
[*]...................Creating New database successfully
[*]...................Creating New Table 'XJGY3ZCPBW' successfully
[*]...................Inserted data correctly into table 'XJGY3ZCPBW'
[*]...................Inserted secret key 'secret_FT7Y' into table
文章来源地址https://www.toymoban.com/news/detail-709263.html
到了这里,关于安装sqli-labs时,mysql 8 报错解决的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!