{"id":11544,"date":"2024-03-07T17:01:22","date_gmt":"2024-03-07T11:31:22","guid":{"rendered":"https:\/\/www.skynats.com\/?p=11544"},"modified":"2025-01-08T20:36:56","modified_gmt":"2025-01-08T15:06:56","slug":"acces-remote-mysql-server-web-phpmyadmin","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/acces-remote-mysql-server-web-phpmyadmin\/","title":{"rendered":"How to access a Remote MySQL Server through Web using phpMyAdmin"},"content":{"rendered":"\n<figure class=\"wp-block-image size-medium\"><img fetchpriority=\"high\" decoding=\"async\" width=\"300\" height=\"186\" sizes=\"(max-width: 300px) 100vw, 300px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/03\/PHP-and-MySQL-web-development-1-1-300x186.jpg\" alt=\"accessing Mysql server through web using phpmyadmin\" class=\"wp-image-11556\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/03\/PHP-and-MySQL-web-development-1-1-300x186.jpg 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/03\/PHP-and-MySQL-web-development-1-1.jpg 696w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Consider a domain &#8220;example.com&#8221; hosted on server 172.xxx.xxx.31 with the document root \/var\/www\/example.com\/public_html\/ and a MySQL server on another server with IP 80.xxx.xxx.123. There are various options for remotely accessing the MySQL server via a web browser. Let&#8217;s look at how it can be done with phpMyAdmin.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we will create a sub directory phpMyAdmin inside the doc root of the domain example.com.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#mkdir  \/var\/www\/example.com\/public_html\/phpmyadmin<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change the current directory to phpMyAdmin<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#cd \/var\/www\/example.com\/public_html\/phpmyadmin\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Download the latest version of phpMyAdmin from the official website and extract it into the document root directory<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#wget https:\/\/files.phpmyadmin.net\/phpMyAdmin\/5.2.1\/phpMyAdmin-5.2.1-all-languages.zip\r\n\r\n#unzip phpMyAdmin-5.2.1-all-languages.zip\r\n\r\n#cd phpMyAdmin-5.2.1-all-languages\r\n\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now, move all of the files in the directory to the doc root of phpMyAdmin, which is ;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\/var\/www\/example.com\/public_html\/phpMyAdmin.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#mv * \/var\/www\/example.com\/public_html\/phpmyadmin\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the zip file using:\u00a0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#rm phpMyAdmin-5.2.1-all-languages.zip\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Set appropriate permissions for the phpMyAdmin directory<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#chown -R apache:apache \/var\/www\/example.com\/public_html\/phpmyadmin\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">There is no need to modify the apache configuration file because it was already used for the old domain. If you want to make any changes, you can do them in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#vim \/etc\/httpd\/conf.d\/example.com\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After making any changes in the apache conf file, always remember to test and restart the service to apply the changes made<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#apachectl -t\r\n\r\n#systemctl restart httpd\r\n\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now go to the modify the phpMyAdmin configuration file,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#cp\/var\/www\/example.com\/public_html\/phpmyadmin\/config.sample.inc.php \/var\/www\/example.com\/public_html\/phpmyadmin\/config.inc.php\r\n\r\n#vim  \/var\/www\/example.com\/public_html\/phpmyadmin\/config.inc.php\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And in the configuration file, find the line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cfg&#91;'Servers']&#91;$i]&#91;'host'] = 'localhost';\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And modify it as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cfg&#91;'Servers']&#91;$i]&#91;'host'] = 80.xxx.xxx.123'';\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After making any changes in the apache conf file, always remember to test and restart the service to apply the changes made<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#apachectl -t\r\n\r\n#systemctl restart httpd\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now go to the modify the phpMyAdmin configuration file,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\r\n#cp\/var\/www\/example.com\/public_html\/phpmyadmin\/config.sample.inc.php \/var\/www\/example.com\/public_html\/phpmyadmin\/config.inc.php\r\n\r\n#vim  \/var\/www\/example.com\/public_html\/phpmyadmin\/config.inc.php\r\n\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And in the configuration file, find the line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cfg&#91;'Servers']&#91;$i]&#91;'host'] = 'localhost';\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And modify it as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$cfg&#91;'Servers']&#91;$i]&#91;'host'] = 80.xxx.xxx.123'';\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After making the changes, save and exit.\u00a0Now, we can access the MySQL server through your web by using the below URL:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u201chttp:\/\/example.com\/phpmyadmin\u201d\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Our&nbsp;<a href=\"https:\/\/www.skynats.com\/blog\/\">Support Team<\/a>&nbsp;is available to help if you encounter any issues or errors.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Consider a domain &#8220;example.com&#8221; hosted on server 172.xxx.xxx.31 with the document root \/var\/www\/example.com\/public_html\/ and a MySQL server on another server with IP 80.xxx.xxx.123. There are various options for remotely accessing the MySQL server via a web browser. Let&#8217;s look at how it can be done with phpMyAdmin. First, we will create a sub directory phpMyAdmin [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[257,5,300,772,68],"tags":[701,46,272],"class_list":["post-11544","post","type-post","status-publish","format-standard","hentry","category-mysql","category-blog","category-database","category-mysql-8","category-server-management","tag-mysql","tag-mysql-server","tag-servermanagement"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/11544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=11544"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/11544\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=11544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=11544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=11544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}