Install wordpress using a distinct MySQL server - php

I have a webserver which support MSSQL only. I need to install WordPress on the server. Thus I wonder if it is possible to use a distinct server for MySQL. I already tried it, but got error Error establishing a database connection.
So there are a couple of questions:
In theory, is it possible to install wordpress using a server for php and another for mysql?
Is it possible that the server providers have security restrictions so that any of the two wouldn't allow connection from the other?
Are there free server providers dedicated to MySQL? Could you please recommend (a preferably lightweight one) ?

Yes, you can use one server for your web server and another for your database. When you are configuring WordPress you would supply the hostname (or IP address) for the database server instead of localhost. This is a common set up that allows you to scale the two servers independently.
Your MySQL server will have to be configured to allow network connections. You'll also want to configure a firewall to only allow connections from your web server(s).
Amazon will host MySQL for you in the cloud, so will EngineYard. Google for "Hosted MySQL" for more results.

Related

MySQL database access without hostname via PHP

I'm doing this for a couple of years now but I haven't faced anything like this. I'm renting a webserver which has MySQL storage. For security reasons the hosting company refused to give me a host name to connect to the MySQL server from a php script. The reason was that there is an IP filter on he server and one can only connect to it with a whitelisted ip. Is there any solution for this situation like a server sided proxy? Also I do have access to the MySQL server via phpMyadmin.
I did some research and I've found that Navicat has proxy support. Altough it's not free.
Based on your description, it sounds like you have a server with MySQL, PHP and phpMyAdmin all running on the same server. If that's the case then typically the hostname for MySQL will be "localhost", possibly with a port or other code added. It is quite common for web hosting companies to not allow remote MySQL access, though the good ones will have it off by default and let you turn it on either for specific IPs (best) or for "everywhere".
When you are logged into phpMyAdmin, take a look at the very top of the main window and you should see something like Server: localhost or Server: www.example.com:3306 - that is your hostname for any MySQL access, provided the PHP code is running on the same server as phpMyAdmin.
If you actually need to run a program on a different server and access that MySQL database then you are probably out of luck.

I am new to cakephp and I am wondering if PhpMyadmin and my cakephp app should be runnning on the same port?

I should be creating a database on phpmyadmin and connecting this database to my cakephp trial project. Should both be running on the same port? (ex:8888) or is it okay that each one of them is running on a different port? Thanks.
phpMyAdmin is a web-based interface to help administrators manage their MySQL databases. It usually runs on whatever port your webserver is using, typically 80 or 443 (for https traffic).
MySQL normally isn't exposed publicly, although your CakePHP application needs to be able to access MySQL directly (either through socket connections or by TCP/IP networking). The default MySQL port is 3306.
I think the CakePHP default is 8765, so your Cake project is probably running its own webserver on that port.
So, by default, none of your applications are conflicting. You don't want anything running on the same port because only one application can use a port at a time. Whichever application grabs the port gets to use it, and the other application probably will fail to start correctly and give an error message.
So it sounds like everything is working correctly.

API to connect to my MySQL Database Remotely

apparently my hosting provider does not support Remote MySQL Usage as it says in its Knowledge Base even though i bought a premium package
remote MySQL connections are disabled for security and performance reasons. You can only connect to MySQL from your PHP scripts hosted on our servers.
is there any way i can make an API so that i can connect to my MySQL Remotely ?. i need to use the Database in my Host Account as a source of information for my Android Application. thanks
You should look into using something like a HTTP Tunnel.
This post outlines a method of doing this for Android.
Basically you connect through this tunnel which is placed on your server, and can the communicate with the server as if you were localhost.
SSH is also another option, although you'll need remote SSH access enabled by your host. That's normally something you'll have to specifically request for them to enable.
You would then create an SSH tunnel using a technique like this and then use that as your connection for your database. Once you've initiated the connection you would then query it as normal.
There are possibilities here.
Your hosting provider may have allowed access of the database only
on certain IP(s) on certain PORTS. In this case, you cannot access
the database even if you write API's because the connection is not
open to the IP/PORT through which you are accessing through.
The database admin can also block access to certain table(s) or
database(s) for certain users.

Synchronise Database between servers via php

I'm needing to synchronise two mysql databases between different servers on a regular basis, by a client-initiated interface. I've been doing it by remote MYSQL connection, and adding the IP of the servers to the whitelist for MYSQL remote connections. Problem is however, that the client has a dynamic IP, so as soon as it changes they can no longer sync.
So I'm trying to find an alternative way of synchronising the two databases via some sort of secure php script.
edit: I should make this a bit clearer. I've got a server (WAMP) running on a PC (Win7) the database of which I need to synchronize (both ways) to an online server. I've been doing it via remote MySQL connect, which I'd like to avoid because of dynamic IPs, and also because the local WAMP server connects to different internet connections (being a laptop) and needs to not be restricted to one IP.
However you want to synchronize the databases (replication, a PHP script, etc.), the best way to secure it would be to either use an IPSec/VPN or SSH tunnel to encrypt all the communication between the two servers. Then you'd just open a regular mysql or http connection through the tunnel.
Using either method, you'll have access to a variety of authentication modes. So you could use a pre-shared key or username/password authentication or both.
You can use an SSH client like PuTTY to initiate an SSH tunnel on a Windows systems. Or if you google IPSec and XAuth, you should be able to find some guides on how to set up an authenticated IPSec VPN.

Host my wordpress site locally using the server database

I have set up my wordpress site on my local machine and I would like it to talk to the live mysql database on the server. I accessed the wp-config.php file on my machine and changed the hostname to use the ip address instead of localhost, but it will not work.
What do I need to do?
It could be that your remote database is configured to accept connections only from localhost for security reasons. Most web providers set it up that way. In that case, you have no chance of making this work.
Anyway, even if you would get it to work, you will encounter two problems: It will be awfully slow, and the HTML served by the remote database will contain references to server URLs (as opposed to local ones).
If you need more detailed information, you will need to post any error messages you get from mySQL.
Alternatively, you can try running the mysql command-line utility to connect.
mysql -u username -h server -p wordpress_database
Make sure that works first before attempting to get Wordpress to connect.
My guess is you won't be able to connect due to firewall issues. MySql uses port 3306 by default, so if the server's firewall doesn't allow connections through that port, you'll either have to change the port mysql is using (probably a bad idea if other apps expect to see MySql on that port) or get that port opened on the server (make sure you only open it for local IPs, so someone else can't get to your MySql instance!)

Categories