Accessing an external phpmyadmin on same network - mysqli

I have a webshop running on a windows 2008 R2 server that can be accessed on a client PC in the same network.
It's working fine, but now I need to get the database from another windows 2008 server instead of running it on the same machine.
I've already installed WAMP on the new server, imported the database into phpmyadmin and opened port 80 for the firewall. In my connection file for the webshop I've changed the HOST to "192.168.0.17:80" (IP adress of the DB server).
I can still connect to the shop and use anything that doesn't use a database, but when I do need the database it loads for a while and it shows me a timeout error.
Pinging to the database from the Webhost server works.
Am I missing something?
Edit:
I can now access PHPMyAdmin from the Webserver through "192.168.0.17/phpmyadmin".
What would I have to enter in the PHP file to connect it to the database?

If you have phpMyAdmin and the webserver running on 192.168.0.17, and the database on, say, 192.168.0.20, then two things need to happen to allow phpMyAdmin to access the database.
MySQL needs to allow users to connect from other machines. By default, this usually is permitted; I'm not particularly sure what changes WAMP might make. If you've created users with host 'localhost', they won't work and you'll need to increase their permissions by modifying the host or creating a new similar user. The usual disclaimers apply about backing up first.
phpMyAdmin needs to be configured to look at the new MySQL server instead of localhost. Open up config.inc.php and edit or change the $cfg['Servers'][$i]['host']... line to read $cfg['Servers'][$i]['host'] = '192.168.0.20';
Once you've done that, you can open up the phpMyAdmin on your webserver and it should now attempt to connect to the other server that now has your MySQL server installed.
I've already installed WAMP on the new server, imported the database
into phpmyadmin and opened port 80 for the firewall. In my connection
file for the webshop I've changed the HOST to "192.168.0.17:80" (IP
adress of the DB server).
I'm not sure what this means. Your web application (what I presume you mean by "webshop") does need to know where the new database is, but port 80 is for web traffic, not MySQL connections (which are port 3306 by default).
One more little note:
In the title you mention "an external phpmyadmin", but in the case of networking as you describe "external" generally means "outside the local network" (which in turn generally means "anywhere on the internet"); I think you mean another machine on the same network which would be internal to your network.
Edit
I realized I'm more confused about your question than I thought, because you wrote
Edit: I can now access PHPMyAdmin from the Webserver through
"192.168.0.17/phpmyadmin".
Which doesn't make sense. I thought you have two servers, the webserver (which runs your web application and phpMyAdmin) and the database server. I am starting to suspect the webserver is actually 192.168.0.17, in which case you've correctly configured your phpMyAdmin to access the new MySQL server, so all you should have to do is update your web application to the proper IP address (without a port!); simply matching what you have in phpMyAdmin's config.inc.php. So instead of 192.168.17:80 as the host in your web application, you want the same hostname or IP address that phpMyAdmin is using to connect to. You can find that on the main page as well under the "Database server" section.

Related

MySQL Workbench cannot connect from home to Google Cloud SQL

I cannot connect to my Google Cloud SQL database from my Macbook Pro using MySQL Workbench.
I have read the help file here:
https://cloud.google.com/sql/docs/mysql/admin-tools
I have added an authorized IP address for my IP per
https://cloud.google.com/sql/docs/mysql/configure-ip#add
I created a user for the database with it set to allow to connect from any host. I get the error "Can't connect to MySQL server on 'XX.XXX.XX.XXX' (60)
I have also attempted to telnet and get a consistent error that I am unable to connect to the remote host
As far as I know, I've followed all the steps but it really seems I'm getting blocked even before the server. I am trying to connect from home and I don't believe my home firewall is blocking things. I am wondering if there's something I need to open up on the GCE firewall but I have successfully connected to this database from other outside tools (e.g., Zapier).
Your best action right now would be to create a proxy with public IP address.
https://cloud.google.com/sql/docs/mysql/connect-external-app
This link will walk you through that process. If this doesn’t solve your issue, then taking your question to ServerFault (Stackoverflow sister site) might give you a better idea of how to fix your issue.

Google Cloud SQL VM refusing connection

I have been stuck trying to figure out why my Cloud SQL VM is refusing my connection from my machine (whom ip address I have added as a subnet). I cann SSH into the VM but i cannot access the VM from a browser to make SQLs. I have scoured the internet for days trying to find a fix but i cannot seem to get pass this point. My apache listens to port 80. Also Id like to add that I have been connecting to my Mysql db for months through php and making sqls so I do not believe the problem is with apache. However if it is please point me to where i should be looking.
It sounds like you have MySQL running on a GCE VM, not an actual CloudSQL instance (that is a different service from GCE). Is that right?
If so, then if you are trying to connect from your local machine directly to the mysql instance, you are probably getting blocked by the firewall. Go to the networks tab (under Compute Engine) on the cloud console and see what firewall rules you have enabled. You might need to add one for 3306 or whatever port you are using.

how to setup web server,application server,db server on multiple vm?

I would like to do my study practice.
To install the multiservers seperating on multiple vm -web server in first vm ,app server in second and db server in the last vm .then,I will create my own webpage to test about accessing data in db .Each of vm is based on VMware in my computer and just do it on localhost environment.not need to connect internet.
How can I do this or Where can I find any Tutorial .Plese give me some suggestion to finish my project ^^"
Thank u very muchh
Just like what you do in physical machines. And IMHO, your question is too general and has nothing to do with virtual machines. I think what you are looking for is how to setup a web server and how to use a database. Why not check the sites such as nginx or apache and mysql or postgresql ?
First of all you need to run all the machines and connected with each other.
By doing this you'll get IP addresses of those machines..
Now simply replace your IP addresses with localhost according to server
Note that every machine must have an appropriate server

how access mysql remote database

i m creating inapp purchage subscription module,
in this app i want to access remote database but problem is that how i connect
my objective-c code with the mysql on the server,
i am not found any sufficient refrence please help me if any refrence or solution is there.
In mySQL, all access from your application to the database server is already remote access. Local access is simply one case of remote access.
If you're working locally, you may be using "localhost" or "127.0.0.1" as the hostname for your data base, and 3306 as the port number. You're using the data base name you set up on your local server, perhaps "arunsdata" or some such thing
You need to find out the hostname and port number of the remote data base server. (The port number is probably 3306.) Then you need to modify your application code to specify that hostname and port number.
Before you do that you will need to have a username and password, and create your data base ("arunsdata" or whatever) on the remote data base and create your tables and other schema items. The administrator of the remote database server can probably help you with this.
Good luck! I remember how confusing this was the first time I faced it. It's simpler than it seems.
You should probably create a web service to access the remote mySQL server database. You can then send a request to the service using NSMutableURLRequest. If you need to return data back, return json since its more light weight than XML.

TCP Ports when Web Server communicates with SQL Server Express

We have a asp.net 3.5 web application running on a hosting company's web server that's got a very strict firewall setup. The web application communicates with our sql server express 2005 which is on a completely different network.
The problem is that the web applications sends our sql server a random port number to connect to when it connects to our sql server on port 1433. Hence the web application can not connect to our sql server because then they have to open a whole range off port numbers on the firewall which they are not prepared to do.
My question is the following. Can you specify either in your connection string or somewhere in your web.config the port the client sends to sql server to connect back to on?
Thanks
If I'm getting you right, you want to do something that goes against how TCP/IP port handling is supposed to work.
You want the web application to always use the same port when connecting to your SQL server? This would mean you can only have one connection open at any given time, and so only one user at any given time. The client is supposed to communicate with a server from a "random" port. It's the basics of networking. At least how I learned it.
I'm not sure you can even force it to use the same port every time, and even if you can I'd advice against it.
I'd say the problem is the firewall, and not your application. I can understand that the SQL server only wants to speak to the IP address that your site is on, but it shouldn't really care which port the client wants to talk over (something like [website-ip]:* -> [sql-ip]:1433). To me, it seems like who ever set up the firewall has some kind of crazy firewall ideas, but maybe that's just me.
Is it possible that your SQL Server Express is configured to listen on dynamic ports? If the 'TCP Dynamic Ports' value is 0, I think it will be dynamic even if you have a specific port configured. That value should be cleared completely.
You can specify port if you are using TCP/IP.
For ex:
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
where DBMSSOCN=TCP/IP