duanmei4149 2016-07-13 05:02
浏览 41

PHP连接到远程MySQL服务器故障

I am hosting a site on some free hosing website called 'freewebhostingarea.com' and for this particular project when I had it running locally on my Apache it worked quite fine but when I uploaded it to the server I can't access the same database which is being hosted on my computer at home. So initially I was running the site under WAMPP using phpmyadmin as the DBMS but when I moved the site I imported the .sql file from phpmyadmin into Workbench and provided external access to root account and to test this I can remotely connect to this database over the Internet from another computer. But the site itself if giving this error:

Access denied for user 'apache'@'localhost' (using password: NO)

But the script to access the database has this code:

<?php 
mysqli_connect('url','username','password');
echo mysql_error();
mysql_select_db('database');
echo mysql_error();
?>

I am failing to understand why it is even using 'apache' as username when I have specified the username to use?

  • 写回答

1条回答 默认 最新

  • dpw43061 2016-07-13 05:13
    关注

    Use this Go to this page and found your mysql username and password

    <?php
    $usernmae = '996869';
    $password = '996869';
    $dbname = '996869';
    
    $db_conx = mysqli_connect("localhost", "root", "", "project2");
    if (mysqli_connect_error()) {
        echo mysqli_connect_error();
        exit();
    } 
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序