I have an MSSQL dump file that I want to import into a MySQL database. I attempted doing so via phpMyAdmin and setting the compatibility to MSSQL but that doesn't seem to work. It consistently throws MySQL server has gone away. Upping the max_allowed_packet and wait_timeout didn't do anything to solve that either.
Is there a better way to import this database dump?
Try SQL Server Integration Services (SSIS), an ETL tool (Extract, Transform and Load) which is very much needed for the Data warehousing applications. Also SSIS is used to perform operations like loading the data based on the need, performing different transformations on the data.
Free from MS: http://msdn.microsoft.com/en-us/library/ms143731.aspx
Useful links:
http://www.codeproject.com/Articles/155829/SQL-Server-Integration-Services-SSIS-Part-1-Basics
Assuming you have dealt with all syntax incompatibilities, you can use this:
mysql -u<user> -p < db_backup.sql
If you are just scripting tables and data that should work fine. If you have GO statements in your script remove them, you don't need them for tables and inserts.
If you want to script other objects too you need to review each one as there are significant syntax differences.
Related
So i have a low of dmp files that were to make tables in my sql developer database is there a way I could use those same dump files for my mysql database tables?
I never did that, but Googling around I found out that there are tools that make it possible. T
OraDump-to-MySQL is a program to export data from Oracle dump files into MySQL, MariaDB or Percona database. The program does direct reading from the dump, so Oracle installation is not required. Command line support allows to script, automate and schedule the conversion process.
I'm not posting a link (so that someone wouldn't call it spamming); I guess you'll be able to find it yourself.
Is there a way of synchronizing two databases as a batch process?
I have a database on my server but i want to have the same database
running on localhost , i know i can download the entirely database and import it
to localhost but
is there a way to import it once and then just run the insert,update,delete querys
that have been done on the server?
is there a log where queries that have been runned are stored? (queries not resultsets)
So far the only way i found it possible was to keep data structure and import all the data every day
Thanks !
I believe there is software to actually do this (version control and push/replicate databases). Off the top of my head, something available for sql server and mysql is called Redgate (http://www.red-gate.com/). Alternatively docker might offer a similar service but for mysql (https://docker.com/).
I think you can run a cron to do so ... Meaning write a script for exporting database from server and import the same using mysqldump command so in that way you would be able to synchronized the same..
to see the log of my sql queries.. please follow this
Edit mysql configuration file:
vi /etc/my.cnf
This will only log slow queries. You need the general log if you want to see all queries.
general_log = 1
general_log_file = "/opt/lampp/logs/query.log"
Note that you'll need to restart the server for this to take effect. Also, you should only use this type of logging during testing as it does cause slowdown.
for more in detail how-to-enable-general-query-log-in-mysql-under-linux
Caveat: I have zero experience with MySQL.
I've been given a series of files to do a data conversion and would like to migrate the provided data into SQL Server 2008. The files are:
*.myd
*.myi
*.frm
These file types, as I understand it, are MyISAM. I believe that if I had a running MySQL instance, migrating to SQL Server would be fairly straightforward. I could could either use SQL Server's import wizard or Microsoft SQL Server Migration Assistant for MySQL v1.0. Unfortunately, these files are what I'm stuck with -- I just don't have access to the original MySQL instance.
I also don't presently have MySQL as a running instance locally and I'm not sure if there would be compatibility issues with the files I have.
Can I attach them to MySQL 5.5 with the goal of performing a SQLDump or perhaps to use either tool mentioned above? Am I missing a better way?
Yes, you can easily attach them to MySQL 5.5. Then you can dump the tables using mysqldump (be aware that you will need to either modify dump and remove mysql-specific stuff from the dump, or probably customize mysqldump output - check mysqldump documentation for details). You can also try to link Mysql instance to SQL Server, and then copy tables using SELECT ... INTO [sql_server_table_name] FROM [mysql_table_name].
In any case, the hardest part is to migrate stored procedures/triggers. Mysql and SQL Server have quite a different syntax for them, so you probably cannot automate this process.
Update
Also, I forgot to mention that you will have to modify mysql auto_increment columns to IDENTITY([next_auto_increment_value],1) SQL server.
I need to migrate data from SQL Server 2000 to MySQL. Currently I am using MySQL workbench. Can any one tell how to do this?
If you are searching for a tool MySQL has a tool called "MySQL Migration Toolkit" that can be used to migrate the data from SQL to mysql. But the first thing as mentioned above is to do a backup. The next thing to check would be whether there are any datatypes that cannot be converted?
Exactly, what have you tried? You can quickly migrate data from MSSQL to MySQL if they are in any of the following data file formats:
Paradox (.db)
DBase (.dbf)
Delimited Text (.txt)
Excel (.xls)
XML (.xml)
MS Access Database (.mdb)
ODBC
If its a one-to-one, exact same database architecture on both the new and the old servers, you might want to try using database tools meant to make this an easier process for GUI based administrators. Just go to download.com and find some software that may assist you in that migration, Navicat is a good one. The most important thing is to always BACK IT UP! BACK IT UP! BACK IT UP! Never do anything without mirroring drives and doing whatever it takes to make sure if you don't destroy any data, but if you do you'll have backup copies of it. Also how fast your machines are will be a sizable factor when it comes to migrating very large databases.
All in all you have many options to choose from, yet the most important thing is to back it up! Can't stress that enough, yeah it might seem like meaningless extra work especially on humongous database systems, but trust me, its better to be safe than sorry. Also, I always like rebooting machines prior to making database changes to them, cutting off any connection to the outside world or any processes depending or updating its data. Turning off the ODBC will do much of that for you on Windows as well, but as always better safe than sorry. Many a corruption can be avoided by simply booting the machine and having all data in memory finalized on the active database, before backing it up or appending to it.
Check out etlalchemy. It is a free, open-sourced Python tool capable of migrating between any of the following SQL databases: PostgreSQL, MySQL, Oracle, SQL Server, and SQLite.
To install: pip install etlalchemy
To run:
from etlalchemy import ETLAlchemySource, ETLAlchemyTarget
# Migrate from SQL Server onto MySQL
src = ETLAlchemySource("mssql+pyodbc://user:passwd#DSN_NAME")
tgt = ETLAlchemyTarget("mysql://user:passwd#hostname/dbname",
drop_database=True)
tgt.addSource(src)
tgt.migrate()
I backed up my db with mysqldump from phpMyAdmin. Using MySQL 5.0.22. Made no changes to database file. Import fails. Found many instances of extra spaces using notepad, but now cannot find any other such extraneous spaces. Error is 1064.
Any suggestions on how to import file properly?
Thanks.
I encountered problems with mysql dumps of entire databases including views. So now I dump the tables and data as a separate dump, and export the views, stored routines and functions separately. I restore the tables first then the views etc.
Having come from MS SQL Server and Oracle I would like to know if there are any totally reliable tools out there for MySQL database backups and restores.
You have done several things wrong here
Using PHPMyAdmin for anything critical, especially backups. It is not production-ready, in my experience. Feel free to use it for unimportant read-only work on noncritical servers however.
Editing mysqldump files with notepad (or any other editor). Despite appearances, mysql dump files are not text files and should not be edited with any editor. They contain binary data which is not valid in most character encodings, and therefore can probably not be loaded/saved without introducing errors.
Make a fresh dump using mysqldump, which is the only reliable way of making them, and import that. Do not edit mysql dump files using notepad or any other text tool (this includes the likes of grep, sed etc).
If you need to edit a mysql dump file, then restore it into another (i.e. non-production) database instance, make the necessary changes using SQL commands and re-dump the database. This may be slow but it's reliable.