Remote MySQL Access
51 views
Database Management
<h3>Connecting to MySQL from External Applications</h3>
<p>By default, MySQL databases on your hosting server only accept connections from <code>localhost</code> (the server itself). If you need to connect from an external application, a remote server, or a local development environment, you must enable remote MySQL access for the connecting IP address.</p>
<h3>Enabling Remote Access in DirectAdmin</h3>
<ol>
<li>Log in to DirectAdmin.</li>
<li>Navigate to <strong>Account Manager</strong> or find <strong>MySQL Management</strong>.</li>
<li>Click on <strong>Remote MySQL</strong> (or <strong>Remote Database Access</strong>).</li>
<li>Enter the IP address of the computer or server that needs to connect.</li>
<li>Click <strong>Add Host</strong> or <strong>Submit</strong>.</li>
</ol>
<div class="alert alert-info">To find your current public IP address, visit <code>https://whatismyip.com</code> from the computer that needs to connect to the database.</div>
<h3>Connecting from a Remote Application</h3>
<p>Use the following connection details in your remote application or database client:</p>
<ul>
<li><strong>Hostname:</strong> Your server's IP address or hostname (not <code>localhost</code>).</li>
<li><strong>Port:</strong> <code>3306</code> (default MySQL port).</li>
<li><strong>Database:</strong> Your database name (e.g., <code>username_dbname</code>).</li>
<li><strong>Username:</strong> Your database username (e.g., <code>username_dbuser</code>).</li>
<li><strong>Password:</strong> Your database user's password.</li>
</ul>
<h3>Connecting via MySQL Workbench</h3>
<ol>
<li>Open MySQL Workbench and click <strong>New Connection</strong>.</li>
<li>Enter a connection name for reference.</li>
<li>Set the hostname to your server's IP address.</li>
<li>Enter the port as <code>3306</code>.</li>
<li>Enter your database username.</li>
<li>Click <strong>Store in Vault</strong> to save the password.</li>
<li>Click <strong>Test Connection</strong> to verify, then <strong>OK</strong> to save.</li>
</ol>
<h3>Security Considerations</h3>
<ul>
<li>Only add IP addresses that genuinely need remote access.</li>
<li>Remove IP addresses that no longer need access.</li>
<li>Never use <code>%</code> (wildcard) to allow access from any IP unless absolutely necessary, as this exposes your database to the entire internet.</li>
<li>Use strong, unique passwords for database users that have remote access.</li>
<li>Consider using SSH tunneling for a more secure connection method.</li>
</ul>
<div class="alert alert-warning">If your home or office IP address changes frequently (dynamic IP), you will need to update the remote MySQL access list each time it changes. Consider using a VPN with a static IP for more reliable remote database access.</div>
Need More Help?
Can't find what you're looking for? Our support team is ready to help.
Contact Support