"I am using my computer as a mySQL server. Further, I have created a free account at 0fees .us(as a test hosting), which provides free hosting with a windows panel.It has support for PHP, FTP and it’s own mySQL server(multiple other server tools are available too).
I am trying to create a login page for militarybases (a client) using a ‘login page’, using PHP script, so that users can register and access the website. Rather than using mySQL (default of 0fees. us), I want to use my home PC mySQL server as a database server.
I have taken several steps to do so:
1- Using mySQL Server Instance Configuration Wizard (MSICW).
I am using TCP/IP with port# 3306. For the firewall, I have explicitly added the exception for that port and made the root access possible for remote machines.
2- In mySQL command line. I have granted the access by using:-
[b]GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';[/b]
3 - The port is forward to the router( Multiple tools are used to check it)
4- I made a page ‘login.php’, which is the login page to site forum, which script is saved in .htdocs directory.
Now the issue/problem:
It is trying but failing to connect to the local server. Here is the part of PHP, that is related to the issue here:
$local_host="my_external_ip:3306"; $user_name_guest="new_user"; $pass_local="abc123"; $name_of_db="User_login"; $tbl_name="check_users"; mysql_connect("$local_host", "$user_name_guest", "$pass_local")or die(mysql_error()); mysql_select_db("$name_of_db")or die("Connection Failed");
When attempting to connect to mySQL server, following is showing:
Can't connect to MySQL server on 'my_external_ip' (4)
Note: I don’t see any issue while connecting this server to remote machines on any networks (it is tested using NaviCat, you have to provide your ip and port no. to know the connection status).
Every idea is welcome, and even it is a partial solution.
Thanks for your time.