简体   繁体   English

新手尝试学习如何连接到phpmyadmin

[英]Newbie trying to learn how to connect to phpmyadmin

I have one file on one web serve and my phpmyadmin SQL databases on a seperate server and am currently trying to connect to my external serve but it doesnt seem to work. 我在一个网络服务器上有一个文件,而我的phpmyadmin SQL数据库在单独的服务器上,当前正在尝试连接到我的外部服务器,但它似乎不起作用。

I keep getting the error message: 我不断收到错误消息:

'Access denied for user ''@'localhost' (using password: NO)' '拒绝访问用户'@'localhost'(使用密码:否)'

and am not sure what this means. 并且不确定这意味着什么。

Any help would be greatly appreciated or even an article to get started on figuring this out since I cant seem to find anything myself. 因为我似乎自己都找不到任何帮助,将不胜感激,甚至将不胜感激,甚至会写一篇文章来解决这个问题。

Thank you 谢谢

EDIT --- PDO SCRIPT --- 编辑-PDO脚本-

My PDO Script is the generic one from w3, I have place holders for security reasons. 我的PDO脚本是w3的通用脚本,出于安全原因,我有占位符。

<?php
    $servername = "externalIP";
    $username = "username";
    $password = "password";

try {
    $conn = new PDO("mysql:host=$servername;dbname=Reservations", $username, $password);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "Connected successfully"; 
    }
catch(PDOException $e)
    {
    echo "Connection failed: " . $e->getMessage();
    }


?>

您必须找到您的phpmyadmin页面,并使用密码登录。

Try this one : 试试这个:

if you have not assign password into database for specific user then you just have to apply 'root' as user and leave blank password field and also set your hostname as 'localhost' or 127.0.0.1 如果您尚未为特定用户向数据库分配密码,则只需以“ root”用户身份登录,并保留空白密码字段,并将主机名设置为“ localhost”或127.0.0.1

also remember that you have to start first apache and mysql services before access. 还请记住,访问之前必须先启动apache和mysql服务。

If you are using remote server as database then not required.in that case you have to apply your remote Ip address and also remember that in that remote server if you have not specific user then leave password as blank. 如果将远程服务器用作数据库,则不需要。在这种情况下,您必须应用远程IP地址,并且请记住,如果您没有特定的用户,请在该远程服务器中将密码留空。

one another way to debug mysql connection into your remote server creating mysql connection file with its required paramter to check that your remote server ok or not. 另一种将mysql连接调试到远程服务器中的方法,使用所需参数创建mysql连接文件,以检查远程服务器是否正常。

This error will come most probably because of user permission issue. 由于用户权限问题,很可能会出现此错误。 Make sure you have privilege to that user for that database. 确保您对该数据库的用户拥有特权。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM