Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9157961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:08:29+00:00 2026-06-17T13:08:29+00:00

Im trying to connect to mysql database server from another server. The following are

  • 0

Im trying to connect to mysql database server from another server. The following are configurations on both servers.

Server 1:
I installed xampp with php and apache services and it has the following ip 172.x1.x1.x1

Server 2:
I installed mysql and it has the following ip 172.x1.x1.x2.

the following is the connection script I am using to connect to the database

<?php
    //Database connection constants
    define("DATABASE_HOST", "172.x1.x1.x2");
    define("DATABASE_USERNAME", "root");
    define("DATABASE_PASSWORD", "");
    define("DATABASE_NAME", "management");
?>

The above script is in a file called app_config.php and its located in server 1
The following script is in a file called connect.php and its also located in server 1

<?php
require 'app_config.php';
$connect_error = 'Sorry we\'experiencing connection problems.';
$table_error = 'Table not found';
mysql_connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD)
or die($connect_error);

mysql_select_db(DATABASE_NAME)
or die($table_error);
?>
now when I try to connect I get the following error

Warning: mysql_connect() [function.mysql-connect]: Host ‘hr1.saqa.co.za’ is not allowed to connect to this MySQL server in C:\xampp\htdocs\scripts\functions\database\connect.php on line 4

Fatal error: Call to undefined function handle_error() in C:\xampp\htdocs\scripts\functions\database\connect.php on line 5

It will be awsome if you can help me guys.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:08:31+00:00Added an answer on June 17, 2026 at 1:08 pm

    Since your database server is different from your php/apache server you need to specify the hostname as 172.x1.x1.x2 in mysql-php connection string.

    Also make sure that mysql user root have remote connection permission. Other wise mysql-server will not allow your root user to login remotely. i.e. from your server1.

    You can make sure that from mysql.user table.

    mysql> select Host,User from user where User = "root";
    +------------+------+
    | Host       | User |
    +------------+------+
    | 127.0.0.1  | root |
    | ::1        | root |
    | localhost  | root |
    | sgeorge-mn | root |
    | %          | root |
    +------------+------+
    4 rows in set (0.01 sec)
    

    % means any host.

    To create a user with remote connection permission, use following mysql query:

    mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'your_password';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to connect to remote MySQL server with SSL from PHP using mysql_connect:
I'm trying to connect to a mysql server at dreamhost from a php scrip
I am trying to connect to a remote mysql database from an iPhone. I
I am trying to connect to a MySQL server using PHP's 'mysql_connect()' function, but
I am trying to connect to my mysql database on a remote server (via
I'm trying to port a database from SQL Server Express over to my MySQL
Im trying to connect to a mysql database on my web server, but I
I am trying to connect mysql from within PHP function. The credentials are stored
I am trying to connect to MySql server from my ASP VB application. The
My php code fails to connect to the mysql database on my web server.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.