MySql lost table metadata after exporting the database, how to export mysql schema - mysql

I'm using MySQL for few months and created lots of tables and procedures using MySQL Workbench (8.0). I recently bought a new laptop and exported the old database and imported to the new laptop. But I lost all the metadata of tables and procedures. I need to know the create date of a table and when was it last modified. But it looks to me that the metadata(information_schema) was not included with the export. Is there a special way to export the metadata too or to include information_schema with the data export?
Thanks for looking at my question.
UPDATE: I found that mysql schema contains all the metadata information, but I can't see that in MySQL Workbench 8.0. I found in other posts that the mysql schema is very much exists but is hidden in the Workbench. So how will I export it? Is there any harm in moving mysql schema from one server to the other?

If you didn't backup and restore the mysql schema, then data like CREATE_TIME and UPDATE_TIME are likely lost or have changed.
Backing up INFORMATION_SCHEMA doesn't make sense, since the tables are mostly views on internal system tables.

Related

Export MSSQL table records to MySQL in .sql file

i've a MSSQL database and trying to migrate to MySQL database.. the problem is when I using MySQL WorkBench, some table records in my MSSQL database is not migrated (there is an error and MySQL Workbench not responding).. is there any tools to export MSSQL table records into SQL file that compatible to be executed in MySQL?
Both T-SQL and MySQL and support VALUES clause. So, right click on the database and select Generate scripts from Tasks:
Then you can choose objects:
and then make sure you have selected to get the data, too:
You can even get the schema and change it a little bit to match the MySQL syntax.
For small amount of data this is pretty cool. If you are exporting large tables it will be better to use another tool. For example, using bcp you can export your data in CSV format and then import it in the MySQL database.

SQL database backup and restore on user id

I have a database which contains details about user information.The database contains 20 tables with users specific details.Every table contains user foreign key. I want to be able to backup specific user data from the database and restore the backup. Is it possible to restore the backup on a different database that has same tables. I am working on this but not able to find a documentation or article on this. If you could help me on this if doing this is possible. Thank you in advance
You need to write some SQL to export the data. You can use a number of techniques for example:
Gather data using views, stored procedures or a combination of both.
Export data using linked servers, import export or SSIS.
There is no backup and restore functionality for a subset if data.
(p.s. This is for SQL Server. You have three different database engines in your tags.)

Importing MySQL database

I'm trying to import a mysql database into my grid service account at media temple.
I've made a blank database, but there are already lots of tables there such as:
CHARACTER_SETS
CLIENT_STATISTICS
COLLATIONS
COLLATION_CHARACTER_SET_APPLICABILITY
COLUMNS
COLUMN_PRIVILEGES
ENGINES
EVENTS
FILES
GLOBAL_STATUS
GLOBAL_TEMPORARY_TABLES
GLOBAL_VARIABLES
What are these prexisting tables? How do I get rid of them so I can import my database
It looks like you are looking at the database created by MySQL for its own use, called INFORMATION_SCHEMA.
You have to create a database with CREATE DATABASE YOURNAMEHERE; and then put your database tables in that database.
Check out a good introductory tutorial in MySQL, like http://dev.mysql.com/doc/refman/5.1/en/tutorial.html

Pulling Data from MySql and dropping it into SQL

I was wondering if anybody had any advice or references that explain how to pull data from MySQL and drop it into SQLSever! Any input would be greatly appreciated!! Thanks!
You can add MySQL as a "linked server"
http://forums.mysql.com/read.php?60,123221,123221
Once you did that you can reference the MySQL tables, views, etc with their fully qualified name in regular SQL Server queries
I could not tell if you wanted to access a MySQL database because you were migrating to SQL server, or if you wanted to access a MySQL database on an ongoing basis. I am answering as if you want to migrate, because you already have an excellent answer on accessing MySQL from SQL Server.
If you want to migrate, mysqldump is one way to go. Its format is easily parsed.
You can also write the results of any MySQL table -- and SQL Server for that matter -- to .csv format. .csv format is nearly a universal transfer format for data.

Combine several mssql database to one mysql with php

We are handling a data aggregation project by having several microsoft sql server databases combining to one mysql database. all mssql database have the same schema.
The requirements are :
each mssql database can be imported to mysql independently
before being able to import each record to mysql we need to validates each records with a specific createrias via php.
each imported mssql database can be rollbacked. It means even it already imported to mysql, all the mssql database can be removed from the mysql.
we would still like to know where does each record imported to the mysql come from what mssql database.
All import process will be done with PHP .
we have difficulty in many aspects. we don't know what is the best approach to solve our problem.
your help will be highly appreciated.
ps: each mssql database has around 60 tables and each table can have a few hundred thousands .
Don't use PHP as a database administration utility. Any time you build a quick PHP script to transfer records directly from one database to another, you're going to cause yourself a world of hurt when that script becomes required for production operation.
You have a number of problems that you need solved:
You have multiple MSSQL databases with similar if not identical tables.
You have a single MySQL database that you want to merge the data into.
The imported data must be altered in a specific way before being merged.
You want to prevent all duplicate records in your import.
You want to know what database each record originally came from.
The solution?
Analyze the source MSSQL databases and create a merge strategy for them.
Create a database structure on the MySQL database that fits the merge strategy in #1, including all the new key constraints (like unique and foreign keys) required for the consolidation.
At this point you have two options left:
Dump the data from each of the source databases into raw data using your RDBMS administration utility of choice. Alter that data to fit your merge strategy and constraints. Document this, and then merge all of the data into your new database structure.
Use a tool like opendbcopy to map columns from one database to another and run a mass import.
Hope this helps.