Copy data from remote MySQL server - mysql

I have two MySQL servers on different location. I would like to copy some data from one table on one server to another server. And that process is automated and executed scheduled. Is it possible to do it with php?

You will need to create a cron job. The job can execute a php script. Just google it

Yes with provisos...
you will need access to both servers on the MySQL port (through the
firewall)
you'll need the users set up in the database (in the relevant
mysql tables) to give read/write permissions
you'll need a Cron job to perform the scheduling

Related

I need connection to an Access Database from a mysql stored procedure to update tables i already create in mysql db

The access database is on server in folder. I need to create a stored procedure to connect to the access database and update the table data. It can be truncate then an insert. It is connecting via stored procedure to the access database i cannot figure out. It has to be done via a job on a schedule.
MySQL (the Sun- then Oracle- owned product) lacks the plumbing to connect to external tables unless they're on other MySQL servers. That is, it only has a FEDERATED storage engine. So, with MySQL you'll have to find some other way to handle your requirement; a MySQL event or other stored code cannot hit your Access tables.
MariaDB, the MySQL fork, has a CONNECT storage engine. It allows the server to hit external tables via ODBC, so you can hit Access with it. MariaDB is almost entirely compatible with MySQL, so maybe you can replace your MySQL server with it. The CONNECT documentation says this, however.
...these table types cannot be ranked as stable. Use them with care in production applications.
To me, that warning means don't do it!. Especially with a busy business-critical application (like a credit department might use) you don't want even a little bit of instability. If you truncate a table and then the reload fails, you'll be able to hear users yelling from the next county.
Your requirement is, I believe, to extract the contents of one (or more) Access tables and import them into a MySQL table. That kind of operation is called extract-transform-load etl. It seems you use SSIS for the purpose. That should work, because SSIS can connect to Access (of course) and to MySQL via the Connector/net or Connector/ODBC drivers.
But, scheduled SSIS packages get run from SQL Server database servers. You didn't say you have one of those at your disposal. If your org does have a production SQL Server instance, you can put your Access - to - MySQL package into it.
Otherwise you will have to figure out a way to run your scheduled etl job without relying on a database job (or event, as they're called in the MySQL world). For that you'll use the Task Scheduler on Windows, or a cronjob on a UNIX-derived OS like Linux or FreeBSD.
I bet you can do this work reliably from a Windows PowerShell script or a Linux shell script.

Auto Sync the Sql server table to MYSQL table

I need to auto sync some tables in SQL server(inside corporate network) to remote MySQL server. I wrote a script when it runs it copies the data from SQL server to remote MySQL server. Is there any other way alternate to scheduled script. I found some suggestions like triggers but I don't know whether trigger works in this situation.

How do you generate a create users script from an existing MySQL db?

Have inherited a MySQL database that was completely trashed by the latest Windows 10 build update. The server lost all the user and schema information.
I restored the database back and recreated the users, set all the permissions etc. Obviously I would like to mitigate against this happening in the future but can see no obvious way from workbench to generate a script to create the users and set the permissions as you would from SQL management studio.
Is this possible?
Yes this is possible.
You can execute requests with a batch that is loaded by MySQL with a command from the shell to make what you want done.
I had not tested it myself but I think this link could be helpful.

how to synchronize two databases of different servers?

I have two databases. One is on local server and the other is on a production server. I'm continuously working on the local server and after approval I want to update production server. Wih the current setup, I need to take dump or copy or export of database and then import into production database, every time. Is there any way of synchronization method in phpmyadmin for database on different server.
It is possible to synchronize a model in MySQL Workbench with a live database?
Other then this, how can I do this? I'm able to use queries, the command line and phpmyadmin itself.
Please specified any simple method.
The "synchronisation" feature you are looking for is called replication. A replication can be set up between a master and a slave machine. It does not rely on a constant connection, but stores all changes on the master and replays all those changes on the slave once a connection is established.

Schedule data transfer service in MySQL

I have two DB servers, i.e Server1 and Server2.
I want to transfer data from Server1 to Server2 every morning (at 9:00AM lets say).
How can we achieve it?
Can this transfer of data be done automatically?
My choice on a windows machine is to create a batch file that runs mysqldump with the parameters that suite you best.
This batch file can be tied to the windows scheduler for an automated execution at any point in time.
you can consult this page for some guideline by the MySQL community.
Now that you have a dump of your DB your script should send it to the destination server and deploy it locally (can also be done automatically).
i use the parameters for mysqldump that allows me to incrementally add data to the new server
i transfer the dump using DeltaCopy which is a community windows wrapper around the rsync program (if interested you should check Syncrify on that page as well)
both of those last point allow for an extremely faster process than copying the entire DB everytime.