如何修复hy000/2054时,实现mysql与深渊网络服务器?

bfhwhh0e  于 2021-06-15  发布在  Mysql
关注(0)|答案(1)|浏览(384)

我正在使用abyss x1启动一个web服务器,并尝试使用以下两个脚本通过php实现一个mysql服务器:
连接\u db.php:


# Connect on 'localhost' for user 'admin'

# with password 'RoboticCowboy2019' to database 'site_db'.

$dbc = mysqli_connect
 ( 'localhost' , 'admin', 'password', 'site_db' )
OR die
 ( mysqli_connect_error() );

# Set encoding to match PHP script encoding.

mysqli_set_charset($dbc, 'utf8' );


require.php:


# Incorporate the MySQL connection script.

require ('../connect_db.php');

# Display MySQL version and host.

if(mysqli_ping($dbc)){
    echo 'MySQL Server'.mysqli_get_server_info($dbc).'on'.mysqli_get_host_info($dbc);
}

然而,当我去http://localhost/require.php,我得到以下错误:
“警告:mysqli\u connect():服务器请求的身份验证方法对第6行的/applications/abyss web server/connect\u db.php中的客户端[caching\u sha2\u password]未知”
“警告:mysqli_connect():(hy000/2054):服务器在第6行的/applications/abyss web server/connect_db.php中请求了客户端未知的身份验证方法服务器请求了客户端未知的身份验证方法”
我在遵循一本我知道已经过时的书的指导,但直到现在我还是能解决所有的问题。我也读过,它与mysql更新和实现sha2有关,而php仍然没有?我这样做是为了我的计算机课程,所以我会感谢所有能得到的帮助。
谢谢您!

643ylb08

643ylb081#

更改用户

ALTER USER 'mysqluser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mysqlpassword';

或使用

shell>mysql --default-auth=mysql_native_password

相关问题