mysql replication without direct connection - mysql

I am trying to replicate a remote mysql database to my internal mysql server.
The problem is that I do not have a direct connection available between both mysql servers.
Internally, there is a custom server application (which I've developped my self). This server application allows incoming connections on 1 port only (with ssl encryption). Once the connection is made, custom written commands can be executed over that connection (like sending specific backup files, remote browsing, etc... just client/server stuff).
Now I need to add mysql replication, but there is no direct connection possible. I was thinking to write something like a PORTFORWARD command in my server app which would transfer the replication data to the mysql server interally, something like this:
remote mysql server replication process->remote client application->internal server application-> internal mysql server.
That would probably work, but I think that's gonna be a fragile solution, all connect/disconnect events will need to be forwarded in all circumstances.
Any better ideas for this?
Thanks,
Vincent

Replication in the sense do you want the Remote server database data's to your Internal server?
if So you could follow Backup and Restore MySQL Database Using mysqldump
Or If want your client server application to access the remote server database follow this Can't remotely connect through SQL Server Management Studio

Related

How to connect to the centralized MySQL database from my django website?

Lets say I have two systems that will runs a Django server and one system that will be a centralised database that will only contain database application running on this machine. How can I have two machines connect to same database i.e Read/Write from/to database? What software needs to be running on my MySQL database side so it can get the data from the server and return the data from the database in case of read query ?
The question is how can two server make connection to a centralized database to read/write from it? What code/technology should be running on the database server to send/receive data?
If there are to systems that are solely dedicated as a server and one as a database then how can I make a connection from my two server machine to the centralized database. Which technologies can help me in achieving this? What code should be run on the third machine and how the other two server makes connection to this database?
I fail to understand why you need extra softwares/technology for this.. If all you want to do is make both your django servers access the shared database kn the third server, just point both your django servers to the server running your MySQL.. it should do the job..

MySQL - change connection to MysqlWorkBeanch

I have a server at Amazon with my Database and I usually acess by hpMyadmin with no problem, but I hate that. I downloaded the MYSQL WorkBench but I can't connet to my server, anyway. I am always receiving the same message as follow:
Connecting to MySQL server ... Can't connect to MySQL server on (10061)
Someone, did have the same problem or known how to do?
Thank you.
Most providers allow access to database only from they local network. Databases aren't visible from the internet. The reason - security.
Server with phpMyAdmin is located in their internal network so it have no problem with accessing to database, but your computer is on the outside and DB isn't visible for it, hence the connection error.
If you have ssh(or vpn) access to machine (but you probably don't) you can create tunnel and access your DB through it with workbench.
On the other hand, you should be able to upload your own web client, different than phpMyAdmin e.g http://mywebsql.net/

Update my remote MySQL database with my local MySQL database

I have a local Perl script that does a lot of parsing of web pages and then successfully updates my local MySQL database (WAMP server). I now want to send this local data to my remote server, but remotely connecting to my database isn't allowed with my hosting company. Unfortunately I never thought of that problem.
So, I now need to find an automated way to update my remote server (every 15mins). I mistakenly thought I could just edit my Perl script with the details of the remote server.
I am aware that I could use CGI or PHP to do the parsing on the server, but I really want to keep the parsing local for now.
Summary:
Local MySQL database -> remote MySQL database every 15mins ??
Any ideas what I can do?
Thanks :-)
if replication is not an option but you can still establish an ssh connection from local box to remote box, then
run mysqldump to export data into a file http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_where
scp file to remote box
mysql -u username -p password database_name < dumpfile.sql
If your server does not accept connections to mysql remotely you can create a ssh tunnel. Then you can apply the replication solution proposed by matcheek.
Here is a hint: http://realprogrammers.com/how_to/set_up_an_ssh_tunnel_with_putty.html
Based on the responses I've received, I think the answer to my original question is to stop using a cheap shared hosting company (no remote access to server, no cron jobs, etc) and start using a VPS hosting company. That will give me the freedom to remotely connect to my server, etc.
Thanks again to those who replied.
From how you described the problem replication seems to be the way to go
http://dev.mysql.com/doc/refman/4.1/en/replication-howto.html
Using a cron job could be another option. It would read file from your local machine and import data in the remote box.
I suggest the follwing:
On every local run, write the SQL statements (sans SELECT),
that you run against your copy of the DB also into a file
On your WAMP server create a small PHP script, gives back the oldest script from the first step (soem auth ofcourse)
On your remote server run a cronjob, that gets this from your local server and runs the SQL against the DB, then acknowledges it
On acknowledgement on your WAMP server, drop the file and give back the next one.
While this seems complicated, it allows for a restart after connectivity loss - something that I consider imposrtant.

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.

Create datasource for mysql to different machine in glassfish

I'm using glassfish(v2.11) as my application server and I have another machine for mysql database server. Currently I want to separate the app server and db server, so I create a jdbc datasource to point to mysql server, but it doesn't works as expect, by the way, when I create datasource to point to local machine (glassfish app server and mysql db server in single machine), and It works well.
Is there any configuration I need to care of when pointing datasource to different machine which I use to host my database (MySQL 5.1)?
Besides granting the mysql user you'll connect as the proper rights, specifying the host in the JDBC url, and making sure there's no firewall stopping you (default mysql uses port 3306), there should be no difference.
WOW ...restart glashfish app server and it works .. :)