简体   繁体   English

如何在cpanel服务器中访问我的数据库?

[英]how to access my database in cpanel server?

The following error occur for my website: 我的网站发生以下错误:

Warning: mysql_connect(): Access denied for user 'mydb_db'@'localhost' (using password: YES) in /home/fiveghr/public_html/don/dbconnection/connection.php on line 8 Could not connect: Access denied for user 'mydb_db'@'localhost' (using password: YES) 警告:mysql_connect():第8行上/home/fiveghr/public_html/don/dbconnection/connection.php中用户'mydb_db'@'localhost'的访问被拒绝(使用密码:是)无法连接:用户'的访问被拒绝mydb_db'@'localhost'(使用密码:是)

<?php
$rpath = $_SERVER["DOCUMENT_ROOT"];
require $rpath."/don/dbconnection/config.php"; 
class getdbconnection {
    public function getConnection(){
        //      $con = mysql_connect("localhost","*****","******");
        $con = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
        if (!$con)
        {
            return die('Could not connect: ' . mysql_error());
        } else {
            //          mysql_select_db("real_state", $con);
            mysql_select_db(DB_NAME, $con);
            //return $con;
        }
    }
} 
?>

DB_HOST值必须是服务器地址,为"http://www.myserver.com"而不是本地主机

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

相关问题 如何访问WordPress数据库? 不带面板 - How to access the WordPress database? Without cpanel 如何使用PHP从cpanel访问sqlite3数据库 - how to access sqlite3 database from cpanel using php 我如何在没有cpanel访问的情况下导出mysql数据库 - How can I export mysql database without cpanel access 如何从cpanel访问在终端中从root创建的数据库? - How to access database created from root in the terminal from cpanel? 如何从我的 CPanel 访问 php.ini? - How to access the php.ini from my CPanel? 如何删除服务器(面板)中带有文件的所有文件夹? 我的错误在哪里? - How to Delete all folder with file in server (cpanel) ? where is my Mistake? Codeigniter对于本地主机是可以的,但是在实时服务器上它显示“ database.php不存在”,如果使用linux cPanel,如何定位数据库? - Codeigniter is ok with localhost, but on a live server it says “database.php does not exist”, how can I locate my database if I use linux cPanel? 无需超级用户访问权限即可创建Cpanel API数据库 - Cpanel API Database Creation with out root access 无法访问我服务器上的数据库 - Can't access database on my server 如何使用本地IP地址而不是localhost访问数据库mysql服务器 - How can I access my database mysql server using my local ip address instead of using localhost
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM