Remote Mysql Connections
Author: admin admin Reference Number: AA-00225 Views: 24045 Created: 2011-08-09 11:51 Last Updated: 2025-08-15 09:58 0 Rating/ Voters

How to Set Up Remote MySQL Database Connections

Overview

This guide will walk you through setting up remote MySQL database connections on your iFastNet premium hosting account. Remote connections allow you to access your MySQL databases from external servers, applications, or development environments outside of your hosting account.

Important: Remote MySQL connections are only available on premium hosting plans. If you're on a free hosting plan, this feature is not available.

What You'll Need Before Starting

Before setting up remote connections, you'll need:

  • A MySQL database created on your hosting account
  • A MySQL user with appropriate permissions
  • The IP address of the server/computer that will connect remotely
  • Access to your cPanel control panel

Accessing cPanel

First, you'll need to log into your cPanel control panel:

Method 1 - Via Client Portal:

  1. Go to https://ifastnet.com/portal/clientarea.php
  2. Log in with your account credentials
  3. Click the cPanel login button for direct access

Method 2 - Direct Access:

  1. Go to https://yourdomain.com/cpanel (replace "yourdomain.com" with your actual domain)
  2. Log in with your cPanel username and password

Step 1: Creating a MySQL Database and User

If you don't already have a MySQL database and user set up, you'll need to create them first using the MySQL Database Wizard.

Using the MySQL Database Wizard

  1. In cPanel, find the "Databases" section
  2. Click on "MySQL Database Wizard"
  3. Follow these steps:

Step 1: Create Database

  1. Enter a database name (e.g., "myapp_data")
  2. Click "Next Step"
  3. Note the full database name - it will be in the format: yourusername_databasename

Step 2: Create Database User

  1. Enter a username for the database user (e.g., "dbuser")
  2. Enter a strong password or use the password generator
  3. Confirm the password
  4. Click "Create User"
  5. Write down the username and password - you'll need these for remote connections

Step 3: Add User to Database

  1. Select the privileges you want to grant to this user
  2. For most applications, select "ALL PRIVILEGES"
  3. For security, you can select specific privileges:
    • SELECT - Read data from tables
    • INSERT - Add new data to tables
    • UPDATE - Modify existing data
    • DELETE - Remove data from tables
    • CREATE - Create new tables
    • DROP - Delete tables
    • INDEX - Create and delete indexes
    • ALTER - Modify table structure
  4. Click "Next Step"
  5. Review your settings and click "Finish"

Alternative: Manual Database Creation

If you prefer to create databases manually:

  1. Go to "MySQL Databases" in the Databases section
  2. Create Database:
    • Enter database name
    • Click "Create Database"
  3. Create User:
    • Enter username and password
    • Click "Create User"
  4. Add User to Database:
    • Select user and database from dropdowns
    • Choose privileges
    • Click "Add"

Step 2: Setting Up Remote MySQL Access

Accessing Remote MySQL Settings

  1. In cPanel, find the "Databases" section
  2. Click on "Remote MySQL"
  3. You'll see the Remote MySQL interface

Adding Remote Host Access

  1. In the "Add Access Host" section:
  2. For most users, we recommend entering a single % symbol to allow connections from any IP address
  3. Click "Add Host"

Recommended approach: Enter % (percent symbol) to allow remote access from any location.

Alternative: Specific IP Address (More Secure)

If you want enhanced security and know the exact IP address that will connect:

  1. Find your connecting IP address by visiting whatismyipaddress.com from the computer/server that will connect
  2. Enter that specific IP address instead of the % symbol
  3. Example: 203.0.113.45
  4. Click "Add Host"

Security Considerations

Using % (Recommended for most users):

  • Allows connections from any IP address
  • Perfect when your IP address changes (home internet, mobile connections)
  • Easier to set up and manage
  • Good for development and most personal projects

Using Specific IP Address (More Secure):

  • Only allows connections from that exact IP
  • Best for production environments with sensitive data
  • Requires updating if your IP address changes
  • Ideal for dedicated servers or office environments with static IPs

IP Range (Advanced Option):

  • You can also use ranges like 192.168.1.% to allow an entire subnet
  • Good for office networks where multiple computers need access

Managing Existing Remote Hosts

  • View current remote hosts in the "Access Hosts" section
  • Delete hosts by clicking the "Delete" button next to any host
  • Add multiple hosts if you need access from different locations

Step 3: Finding Your MySQL Server Information

Locating Your Server Hostname

To connect remotely, you'll need the correct MySQL server hostname. Check your welcome email to find your server number, then use the appropriate hostname format:

Possible hostname formats:

  • byethost??.org
  • ifastnet??.org
  • sv??.ifastnet.com

Example: If your server number is 15, your hostname might be:

  • byethost15.org
  • ifastnet15.org
  • sv15.ifastnet.com

Finding Your Server Number

  1. Check your welcome email - this contains your server information
  2. In cPanel, look at the URL - it often shows your server
  3. Contact support if you can't locate this information

Step 4: Connection Information Summary

Once you've completed the setup, you'll have all the information needed for remote connections:

Connection Details:

  • Hostname: (one of the formats above with your server number)
  • Database Name: yourusername_databasename
  • Username: yourusername_dbuser
  • Password: (the password you created)
  • Port: 3306 (standard MySQL port)

Testing Your Remote Connection

Using Command Line (Linux/Mac)

mysql -h hostname -u username -p database_name

Using MySQL Workbench

  1. Create a new connection
  2. Enter the connection details:
    • Connection Name: (your choice)
    • Hostname: (your server hostname)
    • Port: 3306
    • Username: (your database username)
    • Password: (store in keychain/vault)
    • Default Schema: (your database name)
  3. Test the connection

Using PHP (for web applications)

<?php
$hostname = 'your-server-hostname';
$username = 'your-database-username';
$password = 'your-database-password';
$database = 'your-database-name';

$connection = mysqli_connect($hostname, $username, $password, $database);

if (!$connection) {
    die('Connection failed: ' . mysqli_connect_error());
}
echo 'Connected successfully';
?>

Troubleshooting Common Issues

Connection Refused or Timeout

Possible causes:

  • Incorrect hostname or server number
  • IP address not added to Remote MySQL hosts
  • Firewall blocking port 3306
  • Incorrect username or password

Solutions:

  • Verify hostname in your welcome email
  • Double-check the IP address in Remote MySQL settings
  • Ensure port 3306 is open on your local firewall
  • Verify database credentials

Access Denied Errors

Possible causes:

  • Incorrect username or password
  • User doesn't have permissions for the database
  • Using wrong database name format

Solutions:

  • Verify credentials in cPanel MySQL Databases
  • Check user privileges for the database
  • Ensure database name includes your username prefix

"Host not allowed" Errors

Possible causes:

  • IP address not added to Remote MySQL
  • IP address has changed
  • Using dynamic IP that keeps changing

Solutions:

  • Add current IP address to Remote MySQL hosts
  • Use % wildcard for dynamic IPs (less secure)
  • Contact your ISP about static IP options

Security Best Practices

  1. For most users, using % is perfectly acceptable and recommended for convenience
  2. Use specific IP addresses only if you have static IPs and need maximum security
  3. Create database users with minimal required privileges
  4. Use strong passwords for database users
  5. Regularly review and remove unused remote hosts
  6. Monitor database access logs for suspicious activity
  7. Consider using SSL connections for sensitive data
  8. Keep database software updated

Additional Resources

Managing Your Hosting Account

Client Portal: https://ifastnet.com/portal/clientarea.php

  • Monitor hosting account details
  • Access billing information
  • Quick link to cPanel

Direct cPanel Access: https://yourdomain.com/cpanel

  • Replace "yourdomain.com" with your actual domain
  • Direct access to all database management tools

Getting Support

Support Portal: https://support.ifastnet.com/login.php

  • Get help with database configuration
  • First-time users: Register for an account before creating your first ticket
  • Technical assistance with remote connection issues

When to Contact Support

Contact iFastNet support if:

  • You can't locate your server hostname information
  • Remote connections aren't working after following these steps
  • You need help with database performance optimization
  • You're experiencing persistent connection issues
  • You need assistance with advanced database configurations

When creating a support ticket, include:

  • Your domain name
  • The exact error messages you're seeing
  • Your current IP address
  • Database names and usernames you're trying to use
  • Steps you've already tried

Important Notes

  • Premium hosting only: Remote MySQL access is not available on free hosting plans
  • Resource usage: Remote connections count toward your database connection limits
  • Performance: Remote connections may be slower than local connections
  • Backup: Always backup your databases before making significant changes
  • Updates: Server hostnames and IPs can change - check your welcome email for the most current information

Your iFastNet premium hosting includes robust MySQL database features designed to support both local and remote database applications.

Quick Jump Menu