Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Prevent Copying From Mysql Data Tables ?


Recently we had to move some of our databases to the clients site onto their linux server.

Can someone hint on how to prevent "the clients" from snatching our data and db schema? The drawback: they do own the machine - hence they do have a root password, therefore even if I change the unix permissions on the mysql directories - they are still open to the "root".




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Copying Selected Data From Two Tables Into One Table
I have a list of members in my "members" table, and they can buy tickets for an event. When they buy them, their member id number and the ticket info is stored in the "transactions" table. For the final "tickets" table, which I want to print out to put on the door, I also need to have their email and name, which is in the "members" table but not the "transactions" table.

What I want to do is insert bits of the "transactions" table into the "tickets" table, and then also use the member id number from the "transactions" table to lift out the corresponding member name and email address and insert them in as well.

Here's what I tried before I realised that I probably need something quite a bit more complicated:

INSERT INTO tickets (SELECT transaction_id, ticket_member_id, ticket_code FROM transactions), (SELECT name, email FROM members WHERE member_id=ticket_member_id)

member_id is the one in the "members" table.

Basically, here's what I want the "tickets" table to look like (the columns):

transaction_id (from "transactions")
ticket_member_id (from "transactions")
ticket_code (from "transactions")
name (from "members" using ticket_member_id)
email (from "members" using ticket_member_id)

I think I need to use a while to iterate through everything but just thought I'd check in case there's an easy way.

Copying Tables
CREATE TABLE IF NOT EXISTS union_version LIKE union_version_no_pkey;
ALTER TABLE union_version ADD id int primary key not null auto_increment;
INSERT INTO union_version SELECT * FROM union_version_no_pkey;

The first two queries works but the third one gives:
Column count doesn't match value count at row 1

I understand that it is because table union_version has an extra column but why the reference manual says it can work?

May I ask how can I copy all rows from union_version_no_pkey to union_version and so that id of union_version will be generated automatically?

Copying Data
I want to copy some columns in a table of a database to another table in different database. How can I do it?

Copying InnoDB Tables
When using MyISAM tables, all the data and structure files are contained in the one directory - c:mysqldatamydatabase1, for instance. This means that to copy the files from one PC to another is easy.

However, if using InnoDB tables, you have the ibdata1, ib_logfile0 etc. in the c:mysqldata directory, which presumably contain data for all the tables in all the subdirectories.

As a developer, I often want to copy databases and data from clients so that I can work on them directly, but having combined data files would appear to make this impossible, since my overall database will be different from theirs.

Have I missunderstood how the ibdata1, ib_logfile0 etc. work, or is there a simple way to copy InnoDB data files? I have found reference to this on the MySQL site and forums, but nothing that addresses this particular issue.

Copying Tables To Another Database
How do I copy certain tables from one database onto another database (both on the same server)?

Copying Tables From One Database To Another
How can I use a SQL statement to copy some tables (the data and the actual table structures) from one mysql database A to another mysql database B?

Note: Sometimes the structure and the data in database in A may change so I will also have to run that SQL statement in the future and copy over database B the new structures and the new data.

Copying Data Into Another Table?
Can someone please tell me how I can copy one item in one row into another table? I am wanting to do the above when a comment is being added to the second table. Thanks in advance.

My tables are like this:
Article (Articleid, selectDay, selectMonth, selectYear, article_item)
Users (Userid, username, password, email, ip)
Commentpost (Articleid, userid, comments, date_entered)

Copying Data To Server?
i have some database elsewhere than the server, and i'd like to use this db on the mysql system, but can i just copy some mysql databases to the server's data folder? (do i have to "create database..."?)

Copying Data Within A Table
I have a table with about 30 columns and one index. I need to copy a subset of this table back into the same table while changing one value. Obviously this doesn't include the index. The value that I need to change is the one that I will query against to find the subset.

IE: Select * from dogs where color = 'black'

Now take the results of that query and copy it back into the same table with color='white'.

The table has an idex with auto_increment and primary key. I don't want to do anything that would mess this up.

Does this make sense? What Im trying to do is setup a demo of some software using copies of live data. I need to alter the live data a bit to protect the confidentiality of the customer(s). Rather than re-entering data for the demo Id rather copy and alter if its possible and no too huge of a PITA.

Copying Data From One Table To Another
I have a mysql database named swg_db
in that database I have 2 tables, one named swg_user which contains the following fields: username, password, email

the second table is named vbb_user which contains the following fields: username, user_password, user_email

The data in table 1 in password and email is hosed, table 2 is not.

I am trying to figure out the right commands, in the right order, to compare usernames, if they are the same, copy the user_password data from table 2 into the password field in table 1 and to copy the data from the user_email field in table 2 into the email field on table 1.

Copying Data To New Table
I created a new table for my data, and I'd like to copy the data from the first table to the second. The thing is, some of the fields have been removed, and some added. Is it possible to just copy over everything from the rows that has matching fields?

Copying Table Data
Im currently writing an IT database for the company i work for *small thing, more for our use* to keep users and computers data upto date. Anyway things have developed and its going to push to company wide. So currently i have a colum structure as follows

Code:

UserName
Department
MachineNum

Copying Data Folder
I've successfully copy out a database folder under mysql/data directory and put it in another server and it works fine. No need to know the previous admin password or what for the copied database.My question is. Is this normal with mysql? Or this is normal with all DMBS, which we can copy the data folder from one server and put it in another servery, bypassing all the user security, and successfully read the database with admin privilaged given by the second server?Or this is only happened with mysql, and not with other DBMS such as ms-sql and oracle.Is there anyway to prevent this from happening?

Importing & Copying Multiple Tables
I was unable to copy my database from my PC (MySQL version 4.X) to my MacBook Pro (5.0.19), so I exported each of my 170 tables as a SQL file, then copied them over to my Mac. Do I now have to import them into my database one at a time, using phpMyAdmin, or is there a way to suck all of them into a database at once?

I want to import all of them into a temporary database, then copy or move the ones I want to keep into an active database. So I wondered if there's a way to copy or move several tables to another database at a time. It appears that I can do this with the linked tables feature.

However, when I checked both tables in my practice database, then clicked "Operations," I got the following message:

Quote:

The additional features for working with linked tables have been deactivated. To find out why click here.

...followed by this message:

Quote:

PMA Database ... not OK[ Documentation ]
General relation features Disabled

Does anyone know what this means and how to fix it?


Copying Tables Every Time They're Updated
I'm got two tables which need to kept upto date with each other. Is there a command i can cron to copy all the updated entries?

Prevent MySQL Locking Up
I was doing some major work using MySQL this weekend, and I realized that MySQL is quite fragile. I mean, it can lock up so easily, and it's not funny. How can you prevent MySQL from locking up? What things can we really do so that MySQL doesn't lock up the entire server so easily?

Automatically Copying Data From One Table To Another
im working on a project for uni and basically i want to know if its possible for a table to automatically copy data from one table into itself (they are both in the same database)

i want to create a system where a user registers giving their password, i then want the username and password to be stored in a separate table where it is encrypted and when a user wants to login into the system i want their details to be checked against the details in the table where everything is encrypted.

Prevent MySQL From Starting At Startup
I'm starting to play around with MySQL. How can I prevent it from starting up whenever my computer starts? It slows down the startup some, and I'm not always wanting to use it. besides, I can start it myself if I need it.I've had a look on Google for theis, and found quite a few results, but they were fo Linux or Unix. I'm ruinning Windows XP.

Taking Colomns Of Data And Copying It To A Different Table
I've got two pieces of software running and I want to force users to only use the one log in so I though rather than trying to build a plug in I thought a cron job would no-doubt be easier.

Now getting the data I want from the right table is easy enough for me but as the columns have different ID's I need to make it transpose it into the right columns... It runs but I suspect the second part of my code is failing. Code:

MySql Help - Need To Prevent The Duplication Of Information When Inserting To DB
Im am doing the web-based application, where I have to add some information from front-end, and then add it to the database. Now, I would like to get the MySQL statement that will prevent me from adding same thing in 1 table.



How To Prevent MySQL Queries From Taking Too Long
I have a very busy database with some tables having hundreds of thousands of records. I am running MySQL 5.0.16 on Windows. Some of the queries running on my database are not fined-tuned enough, and need improvement. However, the system is live in production and I am looking for a way to prevent MYSQL from committing Harakiri, i.e. from running very slow queries forever, taking the cpu to 50% and beyond for hours. My scripting language is PHP. I found that after a while the end user receives a timeout on the browser, but MySQL continues trying to run the query, sometimes for hours.
My question is, is there a way to specify a timeout for MySQL so that it will abort any queries that it is running that have not returned a result by then. The end user is no longer around anyway, so I am looking for a way to protect the database resources (and in parallel I will start investigating how to optimize the slow queries).

Prevent Writes
How can I prevent writes to a mysql database but at the same time allow reads? This is in the case where I have a master/slave. The master got hosed so I promoted slave. Now I have the master back up and want to swap it back. So I need to stop writes to the slave, take a mysqldump, put it on the master and then start calling the master for writes.

Prevent ON UPDATE CURRENT_TIMESTAMP
Does anybody know if there is a way to prevent an ON UPDATE CURRENT_TIMESTAMP from occuring if I don't want it to?
Only way I can see to do it is by altering the column properties to just a TIMESTAMP field, do the update, then alter the column back.

How To Prevent Stop Words In A MATCH - AGAINST?
I have a simple search engine for my website, and the MATCH-AGAINST works well when search english words (contained in the `name` and `desc` columns), but when try to search a item-code contained in the `sku` column it seems like mysql handle that code (such as "hp-504") as a stop word and returns zero rows...

Prevent Users Creating Their Own Databases
I've installed 4.0.22 and phpMyAdmin 2.6.0-pl2 and followed the instructions, removed the "guest" accounts. Granted users ALL privs on their own db only, which I created. Globally users just have the USAGE priv, no create priv but users can still create their own databases which I need to prevent. What am I missing ?

Prevent One Field Form Overlaping Another
I have the following table:

lesson {
id int,
lesson_start int,
lesson_end int,

PRIMARY KEY(id)
}

No lesson can overlap another. So I can't have rows like:

id | lesson_start | lesson_end
1 | 12:00 | 14:00
2 | 13:00 | 15:00

Is there any way to deal with it from the MySQL level?

Prevent Multiple User Registrations
What's the best way to prevent someone from registering multiple accounts on my website? Should I create a column called "IP Address" in the members table and make it UNIQUE? Are there any complications with this?

PHP/MySQL Combining Data From 2 Tables
I've been slumped over my keyboard trying to figure out a way to do this, but I just cant understand what MySQL logic would be behind this. Any help would be appreciated.


I have two tables (CONTEST_ENTRIES, STORES)

CONTEST_ENTRIES: entrant_name, address, work_region
STORES: store_name, region

Each store needs to give out 3 coupons to different contest entrants. (If I have 10 stores, I'd give out 30 coupons to random people).

Output data would be:
entrant_name, address, store_name

I'm fine with querying both tables individually, but have no idea how to repeat the store data 3x and combine it with the contest entries.

I should try to match CONTEST_ENTRIES.work_region to STORES.region first, then move on if there are no more matches, and assign coupons anyway. But, if this is too tricky then i'd leave it out for now.


Way To Insert Data Into Two Different Tables In Mysql Thru Jsp
I'm working on a project which needs data from existing tables to be displayed as history tables.So i want to know whether there is anyway to insert data into two different tables in mysql thru a single query in a jsp code.

How To Prevent INSERT On Duplicate Rows With 30 Fields
I have a MySQL table with about 30 fields. I am inserting new data, and want to be sure that there are no duplicate rows. A duplicate row would be one with ALL the 30 fields (except the auto-increment index) exactly the same. How do I do that efficiently?

Copying A Mysql Row
I want to copy a row in a mysql table and create an similar row, except the new row will have a different primary key and one other column will be different.
Is there a query to do this? or would I need to pull all the info into PHP and then process it back into mysql?

Copying All Tables From One Schema To Another Schema
I would like to copy all the tables and data in the tables from schema A to schema B. (If the tables are already in B I would like to just replace them with what is currently in A) Does anyone know how to do this?

Compile Data From MySQL Tables On Different Servers
I'd like to retrieve data from MySQL tables on websites A, B, and C, to display on website D -- is this possible? Basically, from site D, I'd like to compile the last entries in specific tables in sites A, B and C, and show them on a "summary page". Do I need to import the data into a local (site D) table, or can I retrieve the data from A, B and C on the fly?

MySql DB Tables And Incorporating The Data Into A Webpage
I dont know much about MySQL or php, but I believe my dilemna resides in the 2.

I am trying to create a web page where a user can input a id number, and be returned with the aliases used by that id number. also, id like there to be a way to upload data through the web page using a MySQL dump file.

the program used to collect the data has a way to export to a MySQL dump file, so getting the data is not a problem. I was told by someone that I would need to create a table in my MySQL database that im using for this project. But the only thing I know how to do is create a new MySQL database using phpMyAdmin.

How To Calculate Data Size In MySQL Tables
In PostgreSQL you can access meta-data about table names, etc. so you could write a program that will automatically scan through all the tables in a database.

How do you do this with MySQL?  

Here's the scenerio:  Want to scan through all the tables in a db, finding data that matches a specifc key value (ie. a specific user), and calculate what percentage of space (and total space) is being used by those matched (that user).

Mysql Question Retreiving Data From Other Tables
i have a table with some numbers, my original query was:
SELECT * FROM table ORDER BY (field1/field2)

i have another table that has rows in it, each with a field1 and field2 value, and i found that each of those columns corresponds to total up to the field1 and field2 in my query, so i could sum(field1) and sum(field2) and use that instead of having a seperate column in the first table.

how can i do this? that's pretty much my question. i want something like this (no idea about the syntax- help!? please):

SELECT * FROM table ORDER BY ( SUM(othertable.field1) / SUM(othertable.field2) )

SQL Error By Copying A DB Within MySQL
I'm using MySQL 4.1.21-standard. When I try to copy a Database named moodle151 to another (not yet existing) DB named moodleISIS, phpMyAdmin 2.7.0 creates the following SQL-query and error message: Code:

Copying A Mysql Database
Mysql3 on an fc3 box. I do not have the root password for mysqld yet i
need to copy a database let's call it database1 to database2. This is for a
site testing purpose, it's to be an exact copy of database1, yet the two
databases do not have to be kept in sync after the copy.

Copying MySQL Database
I'll preface this by saying that my preference is to dump a database to
SQL and transfer that file around but this is not the situation that
I'm in and I'll probably be in this situation in future..

I have all of the files from under C:Program FilesMySQLMySQL Server
4.1data that were copied from another machine while mysqld-nt.exe was
still running. I thought that maybe I could copy these files over to
my machine, after first removing all of the current files. When I
tried to do this I first shut down mysqld-nt.exe then I removed all of
the files under the data folder and then I copied all of the files from
the other machine's data folder.

After doing this I can longer start the mysqld-nt.exe service until I
revert all of the data files back to their original. When I attempt to
start the service I get the following errors logged to the event log:

Server Control Manager:
"The MySQL service terminated unexpectedly."

MySQL:
"Can't init databases"
"Aborting"

Migrating Data Into Existing Mysql Schema Tables
i understand how to migrate data into mysql and to use the migration tool to convert a database to a mysql schema, however, I'm not sure I understand how to migrate specific data tables/columns in the source file to specific tables/columns in the destination mysql tables (where the schema already exists and I'm simply importing data itself).

Copying Or Backingup A Mysql Table
tblVital is part of the db "test" in MySQL, on "C:" via the usual mysqlin mysql route.

How would I say COPY tblVital - or even BACK-UP tblVital, whichever is the most efficient way, please, Gurus?

Is It Good To Store Html-formatted Data In Mysql Tables?
I always thought it is best to keep as much html as you can out of your stored data, in order to have flexible data. I am working now on a user friendly news-editor where the user can add news and format the text as wished (put links, bold/underline/italic etc..).

I am however a bit struggling with how I should proceed with this data. Do I just store it in the appropriate Mysql table and let it come out on the appropriate front-end news page? And not bother about the html in it? What if a user messes with the html? Should I strip all tags before storing it in the database and add them again while retrieving it on the news-page? If so, I know how to convert a few things, but not everything (like links, bold/underline..). Or are there other solutions?

Thanks!

Exporting / Copying A MYSql Database Structure?
I found a programmer who will work on my project, but he wants a copy of my database so he can develop the interface on his server then send it back to me to install. What files do I need to give him so he has the structure of the database?

Data From 3 Tables?
I'm trying in PHP to call out an SQL statement to enter data from 3 tables, now i've done it with two:

Getting Data From 2 Tables
I have 2 tables

table 1
id
date
other infomation....


table 2
id
date
other infomation....


I want to know how to get ALL records from both tables, sorted by date.

Full joins, two outer left joins, and combine. Can someone please give the statement(s) I need to get the info out.

I was thinking of just creating a new table, and dumping the values from both the other tables, but there must be an easier way.

Getting Data From Two Tables
I have 2 tables that I need to work on. From my Client table, I need to go through and look at the client email address for each client (unique email addresses stored in this table). For each client, I need to pull out their name, company name and phone number.

Next, I have to access the Subscriber table, where for each client email address, I access all the subscribers who they have added to their email list. In this table, I have the subscriber email address, plus their name.

For each subscriber email address, I need to send out an email message that contains their sponsor's info from the client table (client email address, name, company name & phone number). Plus, the email that goes out to the subscriber needs to have their name, which is stored in the Subscriber table.

Basically, it looks like this:

for each Client {
   get Client email
   get Client info
   find all Client's Subscribers from Subscriber table
   for each Subscriber {
      get Subscriber email address
      get Subscriber's name
      do variable substitution in the email message
      send out the personalized email to the Subscriber
   }
}

What is the best way to structure all this?

Data From Various Tables
I want to get a list of all files and folders inside of a certain folder.

One thing is important: can I get rid of all the duplicate data that arises from both the entries in `folder` and in `file` having entries like `name` and `last_modified`? When I just use select * from `folder`, `file`, these show up doubly. This is actually my main problem...

So, how would I do this? So basically, there is a certain `folder_id` which I want to examine. All entries in `folder` that have `parent` = that ID should be returned, and all entries in `file` that have `folder_id` = that ID should be returned as well. It doesn't need to be recursive: just one folder's contents are needed.

Data From 2 Tables
SELECT t1.name, t1.items, t2.name, SUM(t2.total) AS tt FROM `table1` AS t1, `table2` AS t2 WHERE t1.name = t2.name AND tt >= 20 GROUP BY t2.name ORDER BY t1.items

I am trying to order the items from table1 based on the total from table2. The problem comes from the WHERE tt >= 20, I always get an error from this. Any ideas on how fix this?

Data From Two Tables
I want to output data from two different tables in one thing of code
i have one table of songs with artist, name, desc etc....but i have another one with ratings. The rating table has a column of an id number that corrosponds to the auto_increment key column of the songs table
i want to get just the rating column from one table
and all of the columns from the other
i have

$query = "SELECT * FROM songs";

but i want it to be like

$query = "SELECT * FROM songs AND SELECT rating FROM ratings WHERE id={$songid}";

is there any easy way to do this?


Copyright © 2005-08 www.BigResource.com, All rights reserved