{"id":493,"date":"2024-09-19T14:42:41","date_gmt":"2024-09-19T14:42:41","guid":{"rendered":"https:\/\/123webhostingindia.com\/tutorials\/?p=493"},"modified":"2024-09-19T14:44:00","modified_gmt":"2024-09-19T14:44:00","slug":"how-to-allow-add-static-ip-in-database","status":"publish","type":"post","link":"https:\/\/123webhostingindia.com\/tutorials\/how-to-allow-add-static-ip-in-database\/","title":{"rendered":"How to allow\/add static IP in Database?"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"593\" src=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/Static-IP-1024x593.webp\" alt=\"\" class=\"wp-image-499\" srcset=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/Static-IP-1024x593.webp 1024w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/Static-IP-300x174.webp 300w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/Static-IP-768x445.webp 768w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/Static-IP-1536x890.webp 1536w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/Static-IP.webp 2003w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#steps-to-allow-add-a-static-ip-to-access-a-database-in-direct-admin\">Steps to Allow\/Add a Static IP to Access a Database in DirectAdmin:<\/a><ul><li><a href=\"#1-log-in-to-direct-admin\">1. Log in to DirectAdmin<\/a><\/li><li><a href=\"#2-navigate-to-my-sql-management\">2. Navigate to MySQL Management<\/a><\/li><li><a href=\"#3-select-the-database\">3. Select the Database<\/a><\/li><li><a href=\"#4-manage-database-users\">4. Manage Database Users<\/a><\/li><li><a href=\"#5-add-allow-access-for-the-static-ip\">5. Add\/Allow Access for the Static IP<\/a><\/li><li><a href=\"#6-save-changes\">6. Save Changes<\/a><\/li><li><a href=\"#7-adjust-firewall-settings\">7. Adjust Firewall Settings<\/a><\/li><li><a href=\"#8-test-the-connection\">8. Test the Connection<\/a><\/li><li><a href=\"#9-secure-your-database-connection-optional-but-recommended\">9. Secure Your Database Connection (Optional but Recommended)<\/a><\/li><\/ul><\/li><li><a href=\"#additional-tips\">Additional Tips:<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">To allow or add a static IP address to access your <strong>database<\/strong>, you need to configure the database server to accept connections from that IP address. This is often necessary when you&#8217;re allowing external access to your database from a specific IP (e.g., for remote administration or third-party applications). Below are the steps to allow a static IP to access a MySQL or MariaDB database via <strong><a href=\"https:\/\/www.squarebrothers.com\/reseller-hosting-india\/\" target=\"_blank\" rel=\"noopener\">DirectAdmin<\/a><\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"steps-to-allow-add-a-static-ip-to-access-a-database-in-direct-admin\">Steps to Allow\/Add a Static IP to Access a Database in DirectAdmin:<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"1-log-in-to-direct-admin\">1. <strong>Log in to DirectAdmin<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open your web browser and log in to your <strong>DirectAdmin<\/strong> control panel using your <strong>Admin\/Reseller\/User<\/strong> credentials.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"2-navigate-to-my-sql-management\">2. <strong>Navigate to MySQL Management<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After logging in, go to the <strong>User Level<\/strong> section (you can also do this at the <strong>Reseller<\/strong> or <strong>Admin Level<\/strong>, depending on your access).<\/li>\n\n\n\n<li>Under <strong>Your Account<\/strong>, click on <strong>MySQL Management<\/strong>. This section allows you to manage databases, users, and access permissions.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"408\" src=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-2-1024x408.png\" alt=\"\" class=\"wp-image-494\" srcset=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-2-1024x408.png 1024w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-2-300x120.png 300w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-2-768x306.png 768w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-2-1536x612.png 1536w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-2.png 1682w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"3-select-the-database\">3. <strong>Select the Database<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>From the <strong>MySQL Management<\/strong> interface, you will see a list of databases associated with your account.<\/li>\n\n\n\n<li>Click the <strong>database name<\/strong> for which you want to allow access from a static IP.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"452\" src=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-3-1024x452.png\" alt=\"\" class=\"wp-image-495\" srcset=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-3-1024x452.png 1024w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-3-300x132.png 300w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-3-768x339.png 768w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-3-1536x677.png 1536w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-3.png 1594w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"4-manage-database-users\">4. <strong>Manage Database Users<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Under the database management screen, you&#8217;ll see a list of users who have access to the selected database.<\/li>\n\n\n\n<li>Find the <strong>User<\/strong> account for which you want to allow external access, or create a new user if needed by clicking <strong>Create New Database User<\/strong>.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-4-1024x547.png\" alt=\"\" class=\"wp-image-496\" srcset=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-4-1024x547.png 1024w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-4-300x160.png 300w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-4-768x410.png 768w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-4.png 1315w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"5-add-allow-access-for-the-static-ip\">5. <strong>Add\/Allow Access for the Static IP<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>By default, MySQL restricts database access to <code>localhost<\/code> or the server&#8217;s internal IP.<\/li>\n\n\n\n<li>To allow access from a specific static IP address:\n<ol class=\"wp-block-list\">\n<li>Click on the <strong>User<\/strong> you want to edit or, if adding a new user, fill in the username and password.<\/li>\n\n\n\n<li>In the <strong>Host<\/strong> field, replace <code>localhost<\/code> with the <strong>static IP address<\/strong> that you want to allow access from.<\/li>\n\n\n\n<li>Alternatively, you can set it to <code>%<\/code> (wildcard) to allow access from any IP address, but this is <strong>not recommended<\/strong> for security reasons.<\/li>\n\n\n\n<li>If you need to allow multiple static IPs, create separate entries for each IP.<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"510\" src=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-5-1024x510.png\" alt=\"\" class=\"wp-image-497\" srcset=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-5-1024x510.png 1024w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-5-300x149.png 300w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-5-768x383.png 768w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-5.png 1391w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"6-save-changes\">6. <strong>Save Changes<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"226\" src=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-6-1024x226.png\" alt=\"\" class=\"wp-image-498\" srcset=\"https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-6-1024x226.png 1024w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-6-300x66.png 300w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-6-768x169.png 768w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-6-1536x339.png 1536w, https:\/\/123webhostingindia.com\/tutorials\/wp-content\/uploads\/2024\/09\/image-6.png 1596w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Once you&#8217;ve updated the host for the database user, click <strong>Save<\/strong> or <strong>Update<\/strong> to apply the changes.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"7-adjust-firewall-settings\">7. <strong>Adjust Firewall Settings<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If your database is hosted on a server behind a firewall, ensure that the server\u2019s firewall allows traffic from the static IP on the MySQL\/MariaDB port (usually port <code>3306<\/code>).<\/li>\n\n\n\n<li>This can typically be done through your server\u2019s firewall settings, either in <strong>DirectAdmin<\/strong> or via <strong>SSH<\/strong> by configuring tools like <strong>CSF (ConfigServer Security &amp; Firewall)<\/strong>.<\/li>\n\n\n\n<li>To allow an IP in CSF (for example), you can run:bashCopy code<code>csf -a &lt;static_IP><\/code><\/li>\n\n\n\n<li>Ensure that MySQL is listening on all interfaces by checking the <code>bind-address<\/code> setting in your MySQL configuration file (<code>my.cnf<\/code>). This is usually found in <code>\/etc\/mysql\/my.cnf<\/code> or <code>\/etc\/my.cnf<\/code>.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"8-test-the-connection\">8. <strong>Test the Connection<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>After allowing the IP, test the database connection using a database client such as <strong>MySQL Workbench<\/strong>, <strong>phpMyAdmin<\/strong>, or a command-line MySQL client.<\/li>\n\n\n\n<li>Use the following connection details:\n<ul class=\"wp-block-list\">\n<li><strong>Host<\/strong>: The IP or domain of the server where the database is hosted.<\/li>\n\n\n\n<li><strong>Port<\/strong>: <code>3306<\/code> (unless it&#8217;s configured to use a different port).<\/li>\n\n\n\n<li><strong>Username<\/strong>: The database user you created or modified.<\/li>\n\n\n\n<li><strong>Password<\/strong>: The password for the database user.<\/li>\n\n\n\n<li><strong>Database Name<\/strong>: The name of the database you&#8217;re trying to access.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"9-secure-your-database-connection-optional-but-recommended\">9. <strong>Secure Your Database Connection (Optional but Recommended)<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If you&#8217;re allowing external connections, it&#8217;s essential to secure the connection using <strong>SSL\/TLS<\/strong> to prevent data from being transmitted in plain text.<\/li>\n\n\n\n<li>Set up SSL certificates on your MySQL server and ensure that clients connecting remotely are required to use SSL.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"additional-tips\">Additional Tips:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Restrict Access<\/strong>: Only allow the specific static IP(s) that need access and avoid using <code>%<\/code> to allow connections from any IP for security reasons.<\/li>\n\n\n\n<li><strong>Monitor Database Logs<\/strong>: Regularly monitor the database logs to identify any suspicious activity or failed login attempts.<\/li>\n\n\n\n<li><strong>Keep MySQL Up to Date<\/strong>: Ensure that your <a href=\"http:\/\/123webhostingindia.com\">database server<\/a> is regularly updated with security patches to prevent potential vulnerabilities.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">By following these steps, you can allow a static IP to access your database securely in DirectAdmin, ensuring that only authorized connections are allowed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To allow or add a static IP address to access your database, you need to configure the database server to accept connections from that IP address. This is often necessary&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[],"class_list":["post-493","post","type-post","status-publish","format-standard","hentry","category-static-ip"],"_links":{"self":[{"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":1,"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"predecessor-version":[{"id":500,"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/posts\/493\/revisions\/500"}],"wp:attachment":[{"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/123webhostingindia.com\/tutorials\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}