how to prevent mysql data file being copied out - mysql

Just wondering is there any ways to prevent mysql data files being copied by others.
I am a developer with mysql as database, i want to protect my tables so no one are possible to copy the table and used it with their own program, or simply to put i don't want other to see my table design.
As we are aware that mysql contains 3 files for each table in the mysql folder, so anyone can copy those files and put it into their own server.

There's no MySQL specific way to achieve that.
If you mean something like file encryption, MYSQL doesn't support that natively.
Have a look at this 3rd party product:
http://www.vormetric.com/products/encryption/database-encryption
But as zerkms correctly commented:
if you have admin/root permissions on a machine - you can do whatever
you want.

Related

Export Specific Records from MySql Workbench

I have databases in my system and also put database on web server also, so when I update my system database data I ll have to then replace or add data into web database.
but
problem is that I am doing changes in database to some specific record frequently for testing purpose.
So I want some mechanism that will used to export some specific records to sql file with insert statement.
Suppose I have made change in table tbl1 and added 10 records to it.
So right now I am manually adding or replacing whole table on web database.
So is there any mechanism in MySql or in Workbench using that I can export specific records.
Any Help for that.
The only automatic solution is to use replication, but that is probably not a good solution for your scenario. So what remains is some manual process. Here are some ideas:
Write a script that writes specific records into a dump file.
Then use a different script to load this dump file into your
target server.
If you frequently change the same records you could create a script
with insert statements that you edit for each new value and run
against both your local and your remote (web) server.

How to upload data from zip file to MySQL database using phpMyAdmin?

I have a client who got a zipped file that has all the database they had in the SaaS app they were using. Now, we have a similar app but our column names are different (obviously) and in some cases we have less columns. So, now i want to upload all this data to my database but i am not sure how to do it?
I run phpmyadmin on the servers.
Extract the file on your desktop.
Login to your phpMyAdmin account.
Click the Import tab.
Select the file to import, file format, ect. and click Go.
Browse through the structure of the imported database to the columns of interest. For each column, click the pencil icon to edit the column (i.e. rename it), or click the X icon to delete it.
To merge data sets, after importing the tables, you would need to run your own query in the SQL tab to merge the data sets.
That are two different tasks in one question,
phpMyAdmin is able to import ZIP-files directly – you don't need to extract them on your local machine. Also be aware of max upload sizes and maximum script execution times, when importing huge database dumps.
To map an existing database to another structure involves a lot of manual work, like renaming tables and columns and copying data from on table to another.I would suggest, you import the old/original database to some "working copy" database and have your new database separate. That way you can use MySQL-features (INSERT INTO new_db.YX … SELECT XY_a FROM old_db.XY) to copy the data where it should go.
Well first you need to take a look at the data files and see how the columns/tables differ. After you sort that out you can go about about figuring out how it insert the data. If the files are large and there are quite a few i wouldnt use phpmyadmin. I'd ssh into the box and use the command line client or set the DB up for remote access and use a local copy of the client.
If youre lucky you won't have to do any processing on the data and you just map values from the old columns to the new columns as part of you LOAD DATA INFILE statement. Whatever you do youll want to test all this on a dummy db(s) first before you go running it in a live environment.

How can I explore mysql database files (*.frm, *.myd and *.myi) without MySQL?

The old versions of our product allowed to capture the current state of the system in a single archive file, which also contains the MySQL database files - lots of <XXX.frm, XXX.myd, XXX.myi> triples .
Now we have the next generation of the product, which does not do anything stupid like capturing the database files, but it must know to read the archives produced by the old versions.
Our product is a commercial closed source product, but it is not very expensive. We had to stop using MySQL, because of the second reason (Oracle has changed the MySQL licensing) and we cannot use MariaDB, because of the first one (their licensing freaked the s*t out of the company lawer).
So, my question is there another way to read these MySQL database files? A commercial light weight solution is fine - after all, we are talking about read-only exploration of the database files. Free/Open Source alternatives are welcome too, as long as they do not mean that the code using them must be Open Source too.
Thanks.
EDIT
Besides the issue whether I can or cannot continue using the old version of MySql to read the old MySql database files, the question remains how can I read them? I mean, MySql is no longer our database, so even if I can bundle with the old MySql implementation, do I have to install the full blown database engine to just read the files? I'd rather avoid that.
If you want to go thru tables structure it would be enough to read the following links.
MySQL internals (all), File Format, MyISAM
If it is not enough and you database size less then 10G you can use Ms SQL Server Express (which is free with DB less than 10G. Page to compare different versions of Ms SQL Server is here). Search for the way to convert MySQL files to Ms SQL Server. Here is the first link a got from Bing: link1 (I suppose not all of them need MySQL server)
If it is not suitable. You can try another MySQL forks like: XtraDB, OurDelta, Drizzle, PBX and so on.
Hope you will find something useful.
We have found a solution. Unfortunately, it involves MySQL, so there are potential licensing issues. Here it is - http://dev.mysql.com/doc/refman/5.0/en/libmysqld.html
All it takes is download the MySql source code and help yourself with:
libmysqld.dll
libmysqld.lib
header files from the include folder
Then it is possible to read the files using the embedded MySQL database engine inside libmysqld.dll.

How to check if two database are identical, and how much is the difference?

I have exported a database and then imported it into a new database. Then I can see that there is a difference in size, which I came to learn that it is due the space reuse issue for deleted entries which is not exported.
So, now two databases should be identical in terms of active (non deleted) entries. But, how can I check that? [system: linux, mysql, phpmyadmin, webmin, etc.]
there are several free and paid tools to do this, both on data and on table structure etc.
most can even generate scripts to sync database a with b.
search google for database compare tool (or something like that)
A simple way of checking if two database schemas are the same is to generate script for each database and compare/diff if the scripts are the same.

MYSQL Database offline use

Is there a way to use a MYSQL database without the database management system.. Like use tables offline without installing the db management system on the machine..
If there is can you please point me in the right direction?
Thank you!
As far as I know, there is no way to do this.
However, there is a portable DBMS SQLIte. It comes in different ways and can be used on other platform with different programming languages.
After reading your comment, I'm almost sure, this is what you need.
It's not that fast as MySQL I guess, but it works.
You can use The embedded MySQL Server Library to access MySQL data files without running the MySQL server.
You can setup a database to work on your localhost. This will be offline unless you setup the front-end stuff to let the internet interact with it.
What exactly do you mean "without the database management system"? You always need a way of interacting with it, even if it is offline. (Otherwise how can it work for you?)
The server side piece of the application, mysql-server, is needed at a minumum to run mysql. This server application comes with all the tools built-in to manage the instance. I doubt you can prevent installation of this.
If you've actually opened the table files in a hex or text editor, you'll see that you will definitely need the mysql application installed to make any sense of them to use them. Sure the records are all there in plain text (.myd files for myisam, the ibdata1 file for innodb tables), but it would be a complete time-waster devising a custom app to parse or update the file structure, as well as trying to tie in table structure contained in the related files for each table.