Results 1 to 8 of 8
  1. #1
    Question I cant connect to my remote MySQL database that I have
    Im not sure which forums I should use or even if Im on the right website but I hope I am in the right one. Hello and I need your help. So Im trying to connect to my MySQL database which does support remote MySql. But theres a problem. I will get an error I cant connect to my database. The problem is, SQLSTATE[28000] [1045] Access denied for user 'mc1931'@'192.168.0.12', it shows it tried to connect to 192.168.0.12 which isnt the correct database. It should have connected to 149.56.147.175 which I have setup. It seems like something is overriding it. Any ideas? Thanks ( Im using freehosting btw )
    Last edited by iskandarluqman; 09-08-2017 at 04:49 AM.

  2. Sponsored Links
  3. #2
    Community Leader
    Join Date
    Sep 2010
    Posts
    982
    Default
    How exactly are you trying to connect? It looks like something is forcing it to your local IP.
    InstaFree.com - Fast, Reliable Hosting...For FREE!

  4. #3
    Default
    Yes true, its forcing me to connect to a local IP. Heres the default settings which was provided by the maker.
    <?php

    final class Settings {
    public static $TRUE = "1", $FALSE = "0";

    public function __construct($connect = true) {
    // Web interface language. Languages are stored in the "lang/" directory.
    $this->lang = 'en_US.utf8';

    // Database information
    $this->host = '149.56.147.175';
    $this->port = 3306;

    $database = 'mc1931';

    $username = '####';
    $password = '###';

    Obviously I would not share the username and password
    It does works fine on other web hosting but only freehosting, which forcing me to connect to a local IP. So I was wondering if there was a fix for this? Freehosting uses CPanal FYI. I can give you the whole files(the website setup) if you wanna check.
    Last edited by iskandarluqman; 09-08-2017 at 05:11 AM.

  5. Sponsored Links
  6. #4
    Community Leader
    Join Date
    Sep 2010
    Posts
    982
    Default
    And you're sure they allow remote connections? That code looks just fine.
    InstaFree.com - Fast, Reliable Hosting...For FREE!

  7. #5
    Default
    I can ensure you theres nothing to do with the SQL Database that Im trying to connect, Im assuming this got something to do with freehosting side? Because the error I got that I shared earlier is
    The web interface was unable to connect to the database using the configuration provided.
    Database error: Access denied
    SQLSTATE[28000] [1045] Access denied for user 'mc1931'@'192.168.0.12' (using password: YES)

    The error appear because it is trying to connect to @192.168.0.12 which is isnt the correct IP. So I was wondering if a hoster can block my access to connect to the database that Im trying to connect, because why would it suddenly redirect to a local IP. Is there anything I can do to fix it? Because I never knew a hoster can block access to access another database. But I couldnt say its blocked because it is just forcing me to connect to 192.168.0.12 when I really setup it to connect to 149.56.147.175 . Im still dont know what is causing this, is it my hoster? Thanks again

  8. #6
    Community Leader
    Join Date
    Sep 2010
    Posts
    982
    Default
    Yes, hosts can (and do) absolutely block outbound connections on 3306. I would venture to guess that the entire port is blocked, but that still doesn't explain the local IP address.

    Do you have localhost in any of your connect code?
    InstaFree.com - Fast, Reliable Hosting...For FREE!

  9. #7
    Default
    Yes and thats why Im confused. If my host really did blocked my connection, it should showed(well atleast the correct IP but the error would be different) :

    The web interface was unable to connect to the database using the configuration provided.
    Database error: Access denied
    SQLSTATE[28000] [1045] Access denied for user 'mc1931'@'149.56.147.175' (using password: YES)

    Im will be sharing, I hope you can see whats causing the problem for it to change to 192.168.0.12 . But how do I even share a link? Spam until I reach 5 posts?

  10. #8
    Community Leader
    Join Date
    Sep 2010
    Posts
    982
    Default
    Can you put that file somewhere else? Too many ads and nonsense on that site. I can't even find the link to download the file. All the links I see are ads.
    InstaFree.com - Fast, Reliable Hosting...For FREE!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •