简体   繁体   English

mysql_connect:访问被拒绝

[英]mysql_connect: Access denied

I´ve found the google-tutorial for store locator: https://developers.google.com/maps/articles/phpsqlsearch_v3#findnearsql 我找到了商店定位器的google-tutorial: https : //developers.google.com/maps/articles/phpsqlsearch_v3#findnearsql

The MySQL-table is done, it works on my server. MySQL表已完成,可以在我的服务器上使用。 I can write addresses and do correctly in phpmyadmin 我可以写地址并在phpmyadmin中正确执行

SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;

But at the tutorial point "Outputting XML with PHP" I can´t go on. 但是在教程“使用PHP输出XML”上,我不能继续。

I´ve created the file "phpsqlsearch_dbinfo.php", put my database details in and uploaded it. 我创建了文件“ phpsqlsearch_dbinfo.php”,将数据库详细信息放入并上传了它。 (all the things in "") (“”中的所有内容)

<? $username="username"; $password="password"; $database="username-databaseName"; ?>

Then I created "phpsqlsearch_genxml.php" as written, put the code from the tutorial in and uploaded it also. 然后,按照编写的方式创建“ phpsqlsearch_genxml.php”,将教程中的代码放入其中并上传。 Which parts have I to change? 我需要更改哪些部分?

When I start the file in the browser there is the following message: 当我在浏览器中启动文件时,出现以下消息:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user: 'dbo420324620@localhost' (Using password: YES) in /homepages/6/d11799920/htdocs/markisen/mx/2/phpsqlsearch_genxml.php on line 15 警告:mysql_connect()[function.mysql-connect]:在/homepages/6/d11799920/htdocs/markisen/mx/2/phpsqlsearch_genxml.php中的用户“ dbo420324620 @ localhost”(使用密码:是)的访问被拒绝15
Not connected : Access denied for user: 'dbo420324620@localhost' (Using password: YES) 未连接:拒绝访问用户:'dbo420324620 @ localhost'(使用密码:是)

What have I done wrong? 我做错了什么?

Either your username, password or database name is wrong. 您的用户名,密码或数据库名称错误。

The error message is deliberately vague in order that unauthorised system-crackers are not helped to find out what they need to change; 该错误消息故意含糊不清,以防止未经授权的系统破解者找出需要更改的内容。 although I guess you know your username and password. 尽管我猜您知道您的用户名和密码。

It's possible the database name you need to use in your PHP code is not exactly the same as that shown in phpMyAdmin. 可能需要在PHP代码中使用的数据库名称与phpMyAdmin中显示的名称不完全相同。 Ask your hosting company what you should use in your include file. 询问托管公司应该在包含文件中使用什么。

I had the same problem using a 1and1.com Managed Server. 使用1and1.com受管服务器时,我遇到了同样的问题。 Tried everything. 尝试了一切。

localhost:/tmp/mysql5.sock and all combinations did not work. 本地主机:/tmp/mysql5.sock,所有组合均无效。

Tried numerous other things and then discovered the solution. 尝试了许多其他事情,然后找到了解决方案。

Go to the PhpMyAdmin Control Panel. 转到“ PhpMyAdmin控制面板”。 Select your database and click phpMyAdmin 选择您的数据库,然后单击phpMyAdmin

You will then see your database tables and at the top you will see your database name dbXXXXXXXX preceded by some info like infoxyz1234:5678 This is the hosting server and port the server is using. 然后,您将看到数据库表,并在顶部看到数据库名称dbXXXXXXXX,其前面带有一些信息,例如infoxyz1234:5678,这是托管服务器和服务器正在使用的端口。

Use this instead of localhost:/tmp/mysql5.sock and mine worked like a charm. 使用它代替localhost:/tmp/mysql5.sock,我的工作就像一个魅力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mysql_connect()访问被拒绝 - mysql_connect() access denied 防止mysql_connect()出错 - 访问被拒绝 - Prevent Error on mysql_connect() - Access denied mysql_connect():用户“ root”的访问被拒绝 - mysql_connect(): Access denied for user 'root' 警告:mysql_connect():访问被拒绝 - Warning: mysql_connect(): Access denied mysql_connect():拒绝用户“ user” @“ host”的访问(使用密码:NO) - mysql_connect(): Access denied for user 'user'@'host' (using password: NO) mysql_connect():用户&#39;root&#39;@&#39;localhost&#39;的访问被拒绝 - mysql_connect(): Access denied for user 'root'@'localhost' mysql_connect():用户&#39;user&#39;@&#39;localhost&#39;的访问被拒绝 - mysql_connect() : Access denied for user 'user'@'localhost' mysql_connect():用户&#39;mss&#39;@&#39;localhost&#39;拒绝访问 - mysql_connect(): Access denied for user 'mss'@'localhost' 尝试连接时为什么会出现“警告:mysql_connect():拒绝用户访问”的提示? - Why am I getting “Warning: mysql_connect(): Access denied for user” when attempting to connect? PHP警告mySql_connect()第4行对用户&#39;a34525_user&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:是) - PHP Warning mySql_connect() Access denied for user 'a34525_user'@'localhost' (using password: YES) on line 4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM