How to seal a database - mysql

I have a MySQL database. I want it to be sealed after inserting datas so it can be unsealed by a client later.
So far, I came to that solution: export the database to a dump file, drop it, crypt the file using asymetric key (the client will get the other key).
Is there any better solution for database sealing?

Related

data migration from mysql to mongodb, i have issue with convergion between IDs

I'm making data migration from MySQL to MongoDB and it's my first time, I followed these steps:-
select all data from SQL in the specific table and save it in one .CSV file.
set headers to the file data so every object has a key.
import the .csv file to DB using MongoDB compass.
the problem is the IDs in SQL away different from the MongoDB objectId, so how can I handle this?
note that the old database "SQL" has primary and foreign keys and my MongoDB schema has references too using objetcId.

Importing a MySQL Table from one server to another server

I need to import the table from One MySQL server to another MySQL server. The requirement looks pretty simple but i tried two ways and unable to import the data. Please find the below details and methods I tried to import the data.
We have an existing table in Server A with Engine Type as MyISAM, No primary key and contains duplicate records.
Now, We need to export this table into a new MySQL server (Server B) but the new MYSQL DB has some rules.
Engine should be InnoDB
Every table should contains a primary key.
The below ways i tried to import and failed.
Method 1:-
Exported the data from server A with Outfile command using MySQL Workbench
and tried to import with Infile command but due to the "mandatory primary key" validation all the
rows were not inserted. So to avoid this added an incremental column in new table and tried to
import but again it's failed due to the no.of columns mismatch error
Method 2:-
Configured both the servers in MySQL WorkBench and exported the table in Server A
with MANAGEMENT-> Data Export and tried to Import with MANAGEMENT-> Data Import/Restore
but due to the engines mismatch between the two tables again it's failed to import the data.
(Tried with Dump project folder and self contained folder).
AFAIK, Now I'm left with only one option (which I don't want to do due to the huge data).
Export the data as a CSV file and Import it by using Table Data Import Wizard.
Please guide me is there any other option to import the Data.
What you can try is to add the new auto inc column to your source table (and add the primary key also, to check if there's no problem). To make this complete you can also convert the table to the InnoDB engine and have it so prepared to be copied over with the least friction.

How to export MS Access database along with schema?

I have got a database in MS Access format and I want to export it to MySQL. I used this tool to import the database to MySQL successfully. However when I try to do "Reverse Engineer" in MySQL Workbench to draw its schema, all I get is tables without relationhip links. Is there something I am missing?
Relationships can only be drawn for foreign keys. If you don't have foreign keys (e.g. only MYISAM tables) then you won't get any relationship. Try the migration module from MySQL Workbench to see if that gives you more in your target schema (tho no promises). If all fails you have to manually add foreignkeys and thereby getting relationships.

export tables of mysql database for insertion into a different database

I have a wordpress instance running on my localhost. In order to move this to another server, I'd like to export the contents of this database to an sql file. However, I don't have the permission to create new databases, I have an existing database in which I'd like to insert the tables and all the rows inside them. Is there a way to tell phpmyadmin to export the data in such a way that everything will be inserted into this new database? Or would it be better to just do a find/replace inside the sql file?
In fact, if you select the database in phpmyadmin, it shows all the tables contained. If you choose to export at that stage, it will export by default (actually depends on its version) all the tables structure and data without database creation. Additionally, it does give you the option of exporting only the 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.