gpt4 book ai didi

mysql - 警告 : mysqli_connect(): (28000/1045): Access denied for

转载 作者:行者123 更新时间:2023-11-30 22:18:16 24 4
gpt4 key购买 nike

我的网页上出现了两个错误。而且我不太习惯弄乱数据库,mysql,所以我需要你帮助我!

Warning: mysqli_connect(): (28000/1045): Access denied for user 'u467224226_yjygu'@'10.1.2.19' (using password: YES) in /home/u467224226/public_html/galeria/api.php on line 8

Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /home/u467224226/public_html/galeria/api.php on line 8

这是代码。

<?php // connect to the database $user_name = ""; $password = ""; $database = ""; $host_name = "localhost";

$con = mysqli_connect($host_name ,$user_name ,$password,$database) or die("Error " . mysqli_error($con)); //check connection

echo "Connection opened";

mysql_close($con); ?>

<?php require_once('include/config.inc.php'); header("Content-type: application/x-javascript");


$connect = mysql_connect($CONFIG['dbserver'],$CONFIG['dbuser'],$CONFIG['dbpass']) or die('Erro ao conectar ao servidor'); $connect_db = mysql_select_db($CONFIG['dbname'], $connect) or die ('Erro ao conectar ao banco de dados');


$resultado = mysql_query("SELECT * FROM `cpg_albums` ORDER BY `cpg_albums`.`aid` DESC LIMIT 0 , 4", $connect)

or die('Nenhum album encontrado com esta query');

echo 'document.write(\'';

if(mysql_num_rows($resultado) == 0){
echo 'Nenhum álbum cadastrado';
} else { echo '<section id="ultimas_fotos"> ';
while($row = mysql_fetch_array($resultado)){
echo ' ';
$album_id = $row['aid'];
$subresult = mysql_query("SELECT * FROM `cpg_pictures` where aid=$album_id order by pid DESC LIMIT 0, 20");

if(mysql_num_rows($subresult) == 0){
$album_img = "http://tisdalephotos.com/images/thumbs/thumb_nopic.png";
} else {
while($subrow = mysql_fetch_array($subresult)){
$album_img = "http://tisdalephotos.com/albums/".$subrow['filepath'].'thumb_'.$subrow['filename'] .$subrow['datebrowse'];

}
}

echo '<div id="ultalb"><a href="http://tisdalephotos.com/thumbnails.php?album='.$album_id.' "><img src="'.$album_img.'" alt="" /></a><div id="ultalbt"><a href="http://tisdalephotos.com/thumbnails.php?album='.$album_id.' ">+</a></div></div>';

echo '';
}
}

echo '</tr></section>';
echo '\');';
?>

最佳答案

假设您的密码正确。

您的用户是否拥有正确的权限?以 root 身份登录然后运行:

select Host, User from mysql.user;

查看为您的用户列出的内容。

如果它丢失了,你可以运行:

CREATE USER 'u467224226_yjygu'@'%%' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON * . * TO 'u467224226_yjygu'@'%%';
FLUSH PRIVILEGES;

关于mysql - 警告 : mysqli_connect(): (28000/1045): Access denied for,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37510383/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com