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:
- Go to https://ifastnet.com/portal/clientarea.php
- Log in with your account credentials
- Click the cPanel login button for direct access
Method 2 - Direct Access:
- Go to https://yourdomain.com/cpanel (replace "yourdomain.com" with your actual domain)
- 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
- In cPanel, find the "Databases" section
- Click on "MySQL Database Wizard"
- Follow these steps:
Step 1: Create Database
- Enter a database name (e.g., "myapp_data")
- Click "Next Step"
- Note the full database name - it will be in the format: yourusername_databasename
Step 2: Create Database User
- Enter a username for the database user (e.g., "dbuser")
- Enter a strong password or use the password generator
- Confirm the password
- Click "Create User"
- Write down the username and password - you'll need these for remote connections
Step 3: Add User to Database
- Select the privileges you want to grant to this user
- For most applications, select "ALL PRIVILEGES"
- 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
- Click "Next Step"
- Review your settings and click "Finish"
Alternative: Manual Database Creation
If you prefer to create databases manually:
- Go to "MySQL Databases" in the Databases section
- Create Database:
- Enter database name
- Click "Create Database"
- Create User:
- Enter username and password
- Click "Create User"
- 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
- In cPanel, find the "Databases" section
- Click on "Remote MySQL"
- You'll see the Remote MySQL interface
Adding Remote Host Access
- In the "Add Access Host" section:
- For most users, we recommend entering a single % symbol to allow connections from any IP address
- 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:
- Find your connecting IP address by visiting whatismyipaddress.com from the computer/server that will connect
- Enter that specific IP address instead of the % symbol
- Example: 203.0.113.45
- 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
- Check your welcome email - this contains your server information
- In cPanel, look at the URL - it often shows your server
- 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
- Create a new connection
- 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)
- 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
- For most users, using % is perfectly acceptable and recommended for convenience
- Use specific IP addresses only if you have static IPs and need maximum security
- Create database users with minimal required privileges
- Use strong passwords for database users
- Regularly review and remove unused remote hosts
- Monitor database access logs for suspicious activity
- Consider using SSL connections for sensitive data
- 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.