Can I use remote database for rackspace cloud server? - mysql

We previously had a company setup our website on a web host and they set it up on a rackspace cloud server (unmanaged). It is an expression engine website.
I have now rebuilt the website into Wordpress but cannot figure out how to setup the database on rackspace. There isn't a database setup on rackspace now, so I'm not sure how the EE site is setup.
I am wondering... Is it possible to just load the wordpress files on the Rackspace server, then connect the Wordpress site to a remote mysql database hosted on Hostgator?
If so, does someone know a a tutorial to do this?
I'm clueless when it comes to uploading a database on Rackspace via SSH. I'm familiar with phpmyadmin but not good with unmanaged servers.
Any suggestion what would be the best for my needs? For now, I need to get the site up and running on Rackspace until I can get a managed dedicated or VPS server setup.
*UPDATE*
I have tried to change the DB host in the Wordpress config file to the IP address instead of localhost, but no luck. Any ideas? This is part of the wp-config.php file in the root directory. I have removed the values. I've tried the hostname like this also with no luck... XXX.XXX.XX.XXX:3306
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'remote_DB_name');
/** MySQL database username */
define('DB_USER', 'remote_DB_user');
/** MySQL database password */
define('DB_PASSWORD', 'hiddenpassword');
/** MySQL hostname */
define('DB_HOST', 'XXX.XXX.XX.XXX');

I'm not an expert with Wordpress but it should be possible to have your wordpress site running on a Rackspace Cloud Server connect to a database that is not on Rackspace.
According to http://codex.wordpress.org/Editing_wp-config.php#Configure_Database_Settings, there should be a file named wp-config.php in the base directory of your Wordpress site. You should be able to edit the values of the constants starting with DB_ to configure database connection settings. Specifically, you will want to change the value of the DB_HOST constant to be the hostname or IP address of your database server that is not on Rackspace.

Normally wordpress allows different database server and can connect it with different servers. But here it seems problem is not with connection settings you use. You have to give proper permissions for your IP to the database server.
Please check and add permissions to your IP on database server using your credentials
GRANT ALL PRIVILEGES ON *.* To 'dbusername'#'XXX.XXX.X.XX' IDENTIFIED BY 'dbpassword';
Check these option with your database administrator and try configuration again
Reference :
Wordpress database COnfigurations

While it may or may not be possible to connect to a Hostgator database from a Rackspace server (contact their respective support departments for details), I know one thing for sure: It's a bad idea anyway. Don't do it.
When they're being used for web applications, MySQL database connections are highly sensitive to latency. Each MySQL query performed by your application will be slowed down by at least the round-trip time — for instance, if there is a 10 ms latency between your web server and database server, and your application performs ten MySQL queries for each page load, your page load will take a minimum of 100 ms (10 ms x 10) more than it would without that latency. Ten queries and 10 ms is a best-case scenario, too; many web applications will use considerably more queries than that, and two distant servers may have a round-trip time much higher than 10 ms (100 ms wouldn't be unusual for a transcontinental connection).
Use a local database. If you don't know how to get one on Rackspace, ask their support team!

Related

setup remote sql server

I've got a small database which is going to be used 1mo/year. I also need a remote access to this database. I have tried dozens of free mysql database servers, but they're all too slow. I mean queries are being executed for ages. For example, it takes 2 mins to execute 10 queries from my Application. What I want is to setup a remote access to my localhost database. I've granted access for '%' IPs, commented bind-address in MySQL config file, but it seems to be working only for local network.
The question is: how do I put my SQL server into the web so anyone could access it using my IP as a host from any location in the world? Is it even possible? At least give me directions how to find an answer. Ty. P.S.: IP is static

How exactly am I accessing the host/server through localhost on phpMyAdmin?

I am working on a school project in which I have to upload data onto a database hosted on phpMyAdmin.
What's confusing me right now is that I see "localhost" at the top of the page and before I even query the database I see "Run SQL query/queries on server "localhost":"
Does this mean that I'm hosting a server on my computer and accessing the database through that? Because then I query for "SHOW VARIABLES WHERE Variable_name = 'hostname';" and it returns with hostname = webhost330. (It is hosted on webhost330.asu.edu).
I'm extremely confused about what this means. Thanks for any possible help.
I'm very new to databases so forgive me if I'm missing something simple here.
EDIT: To clarify: I'm not at school, I'm at my house. What kind of implications does this have? In other words, what's the difference between this and hosting a database locally?
When I host a database on my computer through the MySQL command line client, I can create database information and it's stored on my computer in files. Does this mean that it's initially stored on localhost and then that data is used to create files on my computer?
And then the equivalent of that for the webhost330 is that the localhost stores the database initially but then uploads it to the host at phpMyAdmin? That is the primary thing I'm confused about.
This exactly means what you assumed. When connected to localhost, you are connected to local MySQL server on same machine. Using webhost330.... you are connected to that remote MySQL server instance, if that is not the name of your own machine. Your own server can be webhost30.etcetc.
Edit
If your website is hosted here: webhost330.asu.edu then MySQL host either being webhost330.asu.edu or localhost both mean the same local MySQL server on your very machine.
Edit based on your update
If you are at home, then localhost means you are connected to a MySQL server that you have installed on your own computer. and webhost30.etc.etc means you are connected to the database you have at your school. Database do allow remote connectivity and if you are connected to school from home, that's a remote MySQL connection.
To remove your confusion, you should use only localhost in your code. localhost at home will mean the development server which is your home computer, and when you take the same code to webhost30.etc.etc then localhost for that server will mean its own MySQL installation. So localhost will work everywhere as long as you don't want your code to connect to a remote external MySQL database server.
Assuming you're at school, and assuming you're on your school network. Then yes, your machine is probably "webhost330.asu.edu". At the very least webhost330.asu.edu thinks "webhost330.asu.edu" is localhost.
To see what "localhost" refers to in terms of MySQL server, you have to look at the URL you are using to connect to the web server.
For example, if the URL is
http://localhost/phpmyadmin
and this instance of phpMyAdmin tells me that the MySQL server is on localhost, this means that the MySQL server is on my local workstation.
If the URL is http://example.com/phpmyadmin, then localhost will mean that the MySQL server is on the same machine (example.com).

No "Privileges" in PHPMyAdmin, already tried deleting cookies/using FF/loggin in as 'root'

I'm well aware this has been asked lots of times before but none of the answers so far has been applicable for me or solved the problem.
I want to run SQL Queries from Python using MySQLdb
I get
OperationalError: (1130, "Host '77-172-143-12.ip.telfort.nl' is not
allowed to connect to this MySQL server")
This IP (77-172-143-12) is
for configuring my own router (at home)
I should create a new USER for this
but I don't have the privileges to CREATE USER...s
The Privileges tab is missing from PHPMyAdmin, also when I use Firefox and delete all cookies.
I can't log in
with root and a blank password: I got only one username/login from
my web hosting company when I registered my domain with them.
The
database is on a remote server which I don't manage myself and I seem
not to have any access to any MySQL config files.
How could this possibly be solved?
UPDATE
I understood from the answers that I can't solve this myself since my hosting provider doesn't allow it (by default anyway). I'll contact them to see whether they're willing and able to do something about it.
If somebody else has the same problem: as a workaround I'll keep using my Python routines on my local MySQL database. I'll then use the Wordpress export and import tools to transfer my (updated) local database to the remote server where my website is located. That's not too bad since it will also result in frequent backups of my articles.
It's normal that phpMyAdmin does not show you the Privileges (or Users in recent versions) tab, since you're not privileged.
Usually, on shared servers, hosting providers also use a shared MySQL server, thus they won't allow you root access.
They usually also allow MySQL access only from their web server and not from your home machine, as an additional security measure.
You need to add your hostname (see myip.nl) as a new host in DirectAdmin and then you can connect to the database on a remote server from a local application (Python in this case). See the screenshot below (sorry it's in Dutch!)

Allowing Remote MySQL connections

I'm building an Excel app using VSTO / VB.NET and make several connections to a bunch of databases/tables in MySQL which is hosted on a BlueHost account.
Now, they require for the IP address of the inquiring computer to be registered as a 'host', which sounds great for security but given the app will be distributed to a theoretically unlimited number of people on an unlimited number of computers - it's very impractical for me to individually allow each client IP address in my BlueHost account. What's the best way to allow access, on the fly?
The database user/password will already have the correct permissions to the relevant databases etc. It's just a matter of allowing them access to a remote MYSQL connection to start off with.
I've read around SO to use the 'GRANT ALL' SQL Command but I'm not sure exactly when and where to use this. How would you run a SQL command before making a connection to the database; because it is at this point that the connection throws an error..
Take a look at this it has all your info for conecting to remote servers too, Here

Securely connect MS Access database front-end to MySQL back-end on web host?

We have a fairly simple M$ Access db, split into front-end (forms, reports, etc.) and back-end (tables). Currently looking for a way to get the tables with all the critical data off of one desktop and hopefully into a MySQL database on our web host, and be able to connect to it from multiple PCs (still probably only one or two people connecting to it at any give time), and eventually, hopefully, migrate to a web application when time allows. Many of the examples I've read about people connecting an Access db front-end to a MySQL back-end seem to imply that they are doing so on a LAN, probably behind a firewall, etc.
Is it at all safe to connect a M$ Access front-end to a MySQL backend when that mysql server is running on a remote web host? Does the ODBC connector take care of encryption?
TIA,
Monte
You could use putty to mount a ssh tunnel to your mysql server and redirect the remote mysql port to your machine.
Using putty is pretty straightforward:
Give it your mysql server dns name as the host and go to "Connection/SSH/Tunnels", there you define the local port to connect in the "Source Port" field (e.g. 3307).
In the the "Destination" field put the dns name of your mysql server followed by a colon and the port mysqld is running in (e.g. mysql.example.org:3306).
Save this as a profile then connect and the remote mysql port will be availbable locally on port 3307.
Just make sure you restrict the user because by default he will have an ssh shell on the server.
Setting up key authentication would also be practical because you won't have to enter a password to connect to the server (but be sure to protect your key on disk by encrypting it).
EDIT: It seems the mysql odbc connector support ssl, you could use that too but I'd personnally choose to use SSH anyway as you will have it already on your mysql server.