警告:mysqli_connect():( HY000 / 1045):在第7行的C:\ xampp \\\ htdocs \ projectpmaps \ config.php中对用户'map1user'@'localhost'(使用密码:YES)的访问被拒绝 [英] Warning: mysqli_connect(): (HY000/1045): access denied for user 'map1user'@'localhost' (using password: YES) in C:\xampp\htdocs\projectgmaps\config.php on line 7

查看:104
本文介绍了警告:mysqli_connect():( HY000 / 1045):在第7行的C:\ xampp \\\ htdocs \ projectpmaps \ config.php中对用户'map1user'@'localhost'(使用密码:YES)的访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我收到错误

警告:mysqli_connect():( HY000 / 1045):拒绝访问用户' map1user'@'localhost'(使用密码:YES)在第7行的C:\ xampp\htdocs \ projectpmaps \ config.php







警告:mysqli_error()预计在第7行的C:\ xampp \\\\\\\\\\\\\\\\\\\\\\\\ >
未连接:啊sh * t



config.php文件:

Hi,

Im getting the error
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'map1user'@'localhost' (using password: YES) in C:\xampp\htdocs\projectgmaps\config.php on line 7

and

Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\projectgmaps\config.php on line 7
Not connected : Ah sh*t

config.php file:

<?php
$host = "localhost"; 
$user = "map1user";
$password = "map1password";
$database = "map1";

$connection = mysqli_connect ($host, $user, $password) or die('Not connected : Ah sh*t ' . mysqli_error());
?>





其他文件:



Otherfile:

<?php
require("config.php");

function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}

// Opens a connection to a MySQL server
//$connection=mysqli_connect ('localhost', 'username', 'password');
//if (!$connection) {
//  die('Not connected : Ah sh*t ' . mysqli_error());
//}

// Set the active MySQL database
$db_selected = mysqli_select_db($database, $connection);
if (!$db_selected) {
  die ('Can\'t use db : ' . mysqli_error());
}

// Select all the rows in the markers table
$query = "SELECT * FROM markers WHERE 1";
$result = mysqli_query($query);
if (!$result) {
  die('Invalid query: ' . mysqli_error());
}

header("Content-type: text/xml");

// Start XML file, echo parent node
echo "<?xml version='1.0' ?>";
echo '<markers>';
$ind=0;
// Iterate through the rows, printing XML nodes for each
while ($row = @mysqli_fetch_assoc($result)){
  // Add to XML document node
  echo '<marker ';
  echo 'id="' . $row['id'] . '" ';
  echo 'name="' . parseToXML($row['name']) . '" ';
  echo 'address="' . parseToXML($row['address']) . '" ';
  echo 'lat="' . $row['lat'] . '" ';
  echo 'lng="' . $row['lng'] . '" ';
  echo 'type="' . $row['type'] . '" ';
  echo '/>';
  $ind = $ind + 1;
}

// End XML file
echo '</markers>';

?>





我'实际上是按照Google上的指南访问https://developers.google.com/maps/documentation/javascript/mysql-to-maps#echoxml



但它的给予我那些错误。有谁知道为什么? (我正在使用echo选项检查XML输出位)



我尝试过:



我曾尝试直接输入用户名和密码,并通过变量输入。

我曾尝试将mysqli connect函数移动到配置文件而不是

我尝试创建一个新数据库,一个新用户,一个新表。



我无法正常工作。



任何帮助表示赞赏!



I'm actually following the guide by google on https://developers.google.com/maps/documentation/javascript/mysql-to-maps#echoxml

But its giving me those errors. Does anyone know why? (Im on the Checking the XML output bit using the echo option)

What I have tried:

Ive tried typing the usernames and passwords in directly and via variable.
Ive tried moving the mysqli connect function to the config file instead
Ive tried creating a new database, a new user, a new table.

I cant get this working.

Any help appreciated!

推荐答案

host = localhost;
host = "localhost";


user = map1user;
user = "map1user";


密码 = map1password;
password = "map1password";


这篇关于警告:mysqli_connect():( HY000 / 1045):在第7行的C:\ xampp \\\ htdocs \ projectpmaps \ config.php中对用户'map1user'@'localhost'(使用密码:YES)的访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆