Re: Document / Image (Blob) archival -- Best Practices

2006-04-18 Thread Michael Kruckenberg

Tim,

I did this for a large collection of images, ~1million images up  
around 40 gigs total last time I checked (no longer involved in the  
project). It worked very well, performance was not horrible compared  
to file-based storage. I always feared that MyISAM table getting  
corrupted and having to run a myisamcheck. The backup was a bit  
tricky too, had to have the data replicated elsewhere because it took  
over an hour to backup and we couldn't have the table locked up that  
long on production.


There was a good discussion about this on this weblog recently:
http://sheeri.com/archives/39

No experience with document mangement system. We talked a few times  
about working with a digital library for storage but were never  
compelled to go beyond what we had in MySQL.


Mike

On Apr 18, 2006, at 9:48 PM, Tim Lucia wrote:

Hi all,

I am considering moving some archival records which largely consist  
of blobs
(PDF Image files) out of an Oracle DB and onto MySQL.  Has anyone  
done this
(not necessarily the Oracle part) who can relate their experience 
(s)?  I can
go with MyISAM or archive storage engine, from the looks of it.   
This is not

transactional data, although eventually some reporting may be required
(although since the blob data are things like fax archival  
documents, I'm

not sure what can be reported.)

Another possible storage model would be to use MySQL as the index  
but put
the blobs (.PDFs) into some document management system.  If you've  
done

anything like this, I'd like to hear about it as well.

All input appreciated (to the list, please ;-) )

Tim


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Fetch and updation in single step/query

2006-04-18 Thread Michael Kruckenberg
Seems like what you need is an auto-increment key. Is that out of the  
question?


On Apr 18, 2006, at 1:34 AM, abhishek jain wrote:

Dear Friends,
I run several processes and they need to query the mysql 5.0.8  
database
simultaneously .I have a config table which have the record id. I  
need to

fetch that and increment that .What I feel that the same record id is
fetched by different simultaneosly before i update .Can anyone help  
me in

either:
1)telling me a single query which will fetch and incr. in the same  
query. so

the problem of simultaneously queries are solved.
2)A system by which delaying the other queries are done, I use PHP .
Expecting a quick reply.
Thanks,
Abhishek Jain



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: could a Trigger execute a outside command?

2005-06-27 Thread Michael Kruckenberg

On Jun 27, 2005, at 1:32 PM, Ted Zeng wrote:

I don't know if it is possible under Mac OS. But I assume it is,
consider it is basically a UNIX.

I just want to trigger a shell script, say, a perl script.
Could a shell script be called from a C program?
It looks like I will need to go through a lot of stuff to do this.
Just remember that this shell script will be called for every record  
involved in the database action. If up do an update on the table that  
affects 1000 rows, the database will go through the process of  
calling the UDF and associated system calls for each of the 1000  
rows. This will degrade database performance.


What it is you are trying to accomplish with the shell script?  
Perhaps it could be pulled into the UDF, or into some other mechanism.



On Jun 24, 2005, at 2:42 PM, [EMAIL PROTECTED] wrote:

Isn't this what a User Defined Function would be used for? Your  
trigger

would call the UDF which would do a system().

Or is this not possible under Mac OS?

-Lee

Gleb Paharenko [EMAIL PROTECTED]



I don't know any SQL statements which could launch extern commands,
at least in MySQL. So in triggers it is impossible as well.





Ted Zeng [EMAIL PROTECTED] wrote:



Hi,

I am using MySql on Mac OS X.
I am wondering if I could execute a command (shell, perl) by a  
Trigger.

I read the manual and it seems this is impossible.

ted






Mike Kruckenberg
[EMAIL PROTECTED]
ProMySQL Author
http://promysql.com



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Backup and Maintenance Strategies

2005-06-25 Thread Michael Kruckenberg
I don't know how big your tables are, and if you can withstand any  
downtime. Because we're using MyISAM tables, we use mysqlhotcopy,  
which locks the database as it copies the tables to another location.  
Once that's been done you can rely on your filesystem backup to keep  
copies of the data files but know that they'll be a point-in-time  
snapshot.


We also use mysqldump, which works for all table types and can do the  
job if your tables aren't too large. Again, if you dump your tables  
to another folder/disk, the fs backup is a good way to keep copies of  
that data.


Mike

On Jun 25, 2005, at 1:32 AM, James Tu wrote:


What have people done in the past regarding backup strategies?

Is it adequate enough to rely on filesystem backups for mysql?  
Basically
such that we can restore MySQL to the last filesystem backup. Is  
there a

reason not to do this?

I don't have any mission critical data and data that is lost since  
the last

backup is acceptable.

-James



Mike Kruckenberg
[EMAIL PROTECTED]
ProMySQL Author
http://www.amazon.com/exec/obidos/ASIN/159059505X



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: CHECK constraint

2005-06-25 Thread Michael Kruckenberg
A trigger is a good place to check the value, and change it, bit I  
don't believe you can actually generate a MySQL error within the  
trigger that will prevent the data from being inserted. Currently  
(unless there's been an update to triggers that's not yet in the  
docs), you can only change the value before it gets inserted.


If you are looking to enforce the values going into your JobType  
column,  you might be better off creating a JobType table, with a  
foreign key restraint between the tblJob.JobType and JobType.Name,  
and make sure that the only entries in the JobType.Name column are  
those you want to appear in the tblJob.JobType column.


On Jun 25, 2005, at 10:28 AM, Chris Andrew wrote:


Dear List,

My system is RedHat EL3 and MySQL 5.0.7-beta.

I wanted to implement a check constraint (below), but after some  
testing
and googling, it seems I can't do this with MySQL. I've read  
suggestions

that check(s) should be done using triggers. Is a trigger a preferred
method of achieving the following:

CREATE TABLE tblJob (
  JobId SMALLINT UNSIGNED NOT NULL,
  CustomerIdSMALLINT UNSIGNED NOT NULL,
  JobType   VARCHAR(20) NOT NULL DEFAULT 'DesignInstall',
  Description   VARCHAR(100) NOT NULL,
  QuotationDate DATE NOT NULL,
  OrderDate DATE,
  CHECK (JobType IN ('DesignOnly', 'DesignInstall', 'InstallOnly')),
  PRIMARY KEY  (JobId, CustomerId)
) TYPE=InnoDB;

Regards,
Chris



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql? 
[EMAIL PROTECTED]




Mike Kruckenberg
[EMAIL PROTECTED]
ProMySQL Author
http://www.amazon.com/exec/obidos/ASIN/159059505X



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: CHECK constraint

2005-06-25 Thread Michael Kruckenberg

Hi,
Use enum with a default type and let mysql do the check for you.


The problem with an enum is that if you insert a value that's not in  
the enum, MySQL doesn't stop the insert, it leaves the column empty.  
This doesn't enforce data integrity like I think Chris wanted.


mysql desc enum_test;
+---+---+--+-+-+---+
| Field | Type  | Null | Key | Default | Extra |
+---+---+--+-+-+---+
| id| int(11)   | YES  | | NULL|   |
| name  | enum('test1','test2') | YES  | | test2   |   |
+---+---+--+-+-+---+
2 rows in set (0.25 sec)

mysql INSERT INTO enum_test VALUES (1,'test3');
Query OK, 1 row affected, 1 warning (0.29 sec)

mysql SELECT * from enum_test;
+--+--+
| id   | name |
+--+--+
|1 |  |
+--+--+
1 row in set (0.00 sec)

Mike Kruckenberg
[EMAIL PROTECTED]
ProMySQL Author
http://www.amazon.com/exec/obidos/ASIN/159059505X



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Help with pathnames on a LOAD DATA INFILE

2005-06-20 Thread Michael Kruckenberg
First, remember when MySQL interacts with the filesystem it does so with 
the privileges of the mysql user (or whatever user is running the 
database). You'll have problems if that user doesn't have permissions in 
that dir.


I'm not sure what OS GoDaddy runs, but if it's a flavor of Linux the 
data files are probably in:

/var/lib/mysql
or they might be in:
/usr/local/mysql/data

Brian Dunning wrote:
I've got a GoDaddy virtual dedicated server and I'm trying to run a  
LOAD DATA INFILE, but I keep getting Can't get stat of '/home/httpd/ 
vhosts/04planet.info/httpdocs/test.txt' (Errcode: 13)


As you can see from that error message, I've uploaded my data file to  
the httpdocs directory and trying to run:
LOAD DATA INFILE '/home/httpd/vhosts/04planet.info/httpdocs/ test.txt' 
 etc


I've Googled and read some people found success by uploading their  data 
file to a mysql directory instead, but I can't find such a  directory 
for the life of me by browsing around through this server.  Can anyone 
point me in a good direction?


Thanks.  :)



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: remote connection problem

2005-03-22 Thread Michael Kruckenberg
One other thing to check, make sure --skip-networking isn't specified in
your configuration.

mysql show variables like 'skip_networking';
+-+---+
| Variable_name   | Value |
+-+---+
| skip_networking | OFF   |
+-+---+
1 row in set (0.00 sec)

If the value is ON, you won't be allowed to make connections to the
server via TCP/IP.

On Tue, 2005-03-22 at 15:43 -0600, gerardo Villanueva wrote:
 I have mysql version 4.0.15-nt in a server NT, I can
 connecting with mysql localy, but when i try remote 
 connection the error is:
 Error Number 2003 Can't connect to MySQL server on
 'IP' (10060)   .
 I use mysql odbc 3.51 
 Is necesary the file  my.cnf  in c:\my.cnf
 
 Regards
 
 Gerardo Campos  
 
 _
 Do You Yahoo!?
 Informacin de Estados Unidos y Amrica Latina, en Yahoo! Noticias.
 Vistanos en http://noticias.espanol.yahoo.com
 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: remote connection problem

2005-03-22 Thread Michael Kruckenberg
Not necessary to change my.cnf, unless --skip-networking was specified.
Also assuming that you are using port 3306.

mysql show variables like 'port';
+---+---+
| Variable_name | Value |
+---+---+
| port  | 3306  |
+---+---+
1 row in set (0.00 sec)

Can you verify that network traffic is getting from your remote client
to the MySQL server? When you attempt to connect, do you see network
packets coming to port 3306 on the MySQL server machine? 

On Tue, 2005-03-22 at 16:35 -0600, gerardo Villanueva wrote:
 I execute your query  and
 the skip_networking is OFF. 
 the file my.cnf, have to ubicated in C:\my.cnf or is
 not
 necesary??
 
 Regards
 
 Gerardo Campos
 
 _
 Do You Yahoo!?
 Informacin de Estados Unidos y Amrica Latina, en Yahoo! Noticias.
 Vistanos en http://noticias.espanol.yahoo.com


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



create view - what does the algorithm clause do?

2005-01-17 Thread Michael Kruckenberg
I'm using 5.0.2 and playing with views. The documentation indicates:
CREATE [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] VIEW . . .
I can't figure out what that alrorithm setting changes (it's not 
discussed in the MySQL documentation). I don't see it in the SQL:2003 
docs I have. It looks like temptable is used in SQLite to indicate that 
a view should be temporary for this session, but that doesn't seem to be 
true for MySQL views created with that.

Is it possible that these are currently ignored? The documentation 
usually indicates such.

Anyone have ideas?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Dumping Select statement output onto a text file

2004-10-28 Thread Michael Kruckenberg
There are several ways to get output to a text file, from the Unix shell 
you can:

 mysql -e select * from table database  output.txt
or if you're looking for more of a log of what happened in the MySQL 
client, from the MySQL shell:

 tee output.txt
 select * from table;
Mulley, Nikhil wrote:
Hi List,
 
How do I dump the data from console to the text file from the output generated by SELECT statement ?
 
 
Thanks,
Nikhil.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Server hanging

2004-09-01 Thread Michael Kruckenberg
Back in 3.23.x we used to see MySQL hang on a corrupt table (typically 
caused by an improper shutdown). A kill -9 was needed to stop the 
process, upon restart we'd run a mysqlcheck (MyISAM tables) and repair 
the table. We didn't see anything obvious in the logs except the last 
query, which was attempting to use the corrupt table.

Ronan Lucio wrote:
Hello,
I had a problem with our MySQL server-4.0.18 where
it suddenly stoped working.
Even a KILL command didn´t killed the mysqld process.
I looked for any error message in the file
/usr/local/mysql/hostname.err, but I couldn´t see any error
message about such time.
Does anyone knows what could make MySQL hangs?
And where can I find error messages that could tell me
what happend?
Thanks,
Ronan

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: UPDATE string segment?

2004-09-01 Thread Michael Kruckenberg
You can use the replace string function:
update table set 
file_path=replace(file_path,'aFolder','aFolder/aChildFolder');

In each update aFolder will be replaced by the new path.
John Mistler wrote:
I have a column that holds hard disk file location info such as:
/Volumes/External HD/aFolder/aFile.pdf
/Volumes/External HD/aFolder/anotherFile.pdf
etc. . . (many files located in the same folder)
Can anyone suggest a single statement (or multiple) that would update every
file location located in this same folder to another location, say:
/Volumes/External HD/aFolder/aChildFolder/aFile.pdf
/Volumes/External HD/aFolder/aChildFolder/anotherFile.pdf
etc . . . ?
Thanks,
John
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: all upper case records.. Keeping first char upper and rest lower?

2004-07-13 Thread Michael Kruckenberg
It's ulgy, and I'm not sure how efficient it is, but this will do the trick:
select concat(left(first,1),substring(lower(first) from 2)) as first;
Aaron Wolski wrote:
Hey guys,
I have a column in a table called 'first'.
Currently all records are upper case. Is it possible for me to do a
select statement that makes all chars after the first char lower case?
Example:
Current: AARON
After: Aaron
I think this is possible.. just don't know how to execute the functions
together to make it happen.
Thanks!
Aaron

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: update synopsis error

2004-05-31 Thread Michael Kruckenberg
What version of MySQL are you using? Subqueries aren't available until 
4.1.x.

saiph wrote:
hi,
mysql update table1
set c = (select c2 from table2 where c2 = 'value')
where  id = 123;
give me an ERROR 1064.
i.e.
create table t1 ( id int primary key, name varchar(20) );
create table t2 ( id int primary key, name varchar(20) );
insert into t1 values(1, 'not right')
insert into t2 values(1, 'right')
update t1 set name = (select name from t2 where id = 1) where id = 1;
how i can update right?
--
http://mike.kruckenberg.com | [EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: A Request from a Software Programmer

2004-05-28 Thread Michael Kruckenberg
There are a number of steps after installation that need to happen 
before you will be able to connect:

http://dev.mysql.com/doc/mysql/en/Unix_post-installation.html
naresh bhalala wrote:
Respected Sir/Madam,
I have download the MySQL4.0 from www.dev.mysql.com
and file is
:mysql-standard4.0.20-pc-linux-i686.tar.gz.
I have installed it as bellow:
#gunzip -9c standard4.0.20-pc-linux-i686.tar.gz | tar
-xvf -
and all files r extraced in
folder:standard4.0.20-pc-linux-i686
Now i've run
/standard4.0.20-pc-linux-i686.tar.gz/bin/mysql BUT
ITS GIVING ERROR: ERROR 2002 (HY000): Can't connect
to local server through socket '/tmp/mysql.socket' (2)
pl reply to this mail and solve my prob.
thanking you in advanceNaresh   

--
http://mike.kruckenberg.com | [EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Problems with Order By (phpMyAdmin)

2004-05-27 Thread Michael Kruckenberg
David Blomstrom wrote:
I'm working on an add/edit form, illustrated by the
screehnshot at http://www.geoworld.org/addedit2.gif
I decided to arrange the rows by ID, rather than
alphabetically. So I opened the table in phpMyAdmin,
clicked Operations, then changed Order by from a
field named SCode to ID. When I clicked through, it
defaulted to SCode.
To get the order right on your web page you may need to add order by 
ID to the query in your script. The alter table order by ID statement 
executed from phpMyAdmin reorders the table's current rows, but after 
inserts or deletes the table will no longer be in that order.

http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html
Mike
--
http://mike.kruckenberg.com | [EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Error 1054

2004-05-26 Thread Michael Kruckenberg
Maybe a long shot, but creating this table should have required using 
backticks around `Column` because it's a reserved word. Made me wonder 
if the ID field in the create statement was in backticks as well and 
maybe has an extra character.

What does show create table Spot show?
Hi,
I have a table Spot in the database as follows
 desc Spot
- ;
+---+-+--+-+-+---+
| Field | Type| Null | Key | Default |
Extra |
+---+-+--+-+-+---+
| Name  | varchar(32) | YES  | | NULL|
  |
| ID| int(11) |  | PRI | 0   |
  |
| Row   | varchar(32) | YES  | | NULL|
  |
| Column| varchar(32) | YES  | | NULL|
  |
| Probe_ID  | int(11) |  | | 0   |
  |
| Array_Type_ID | int(11) |  | | 0   |
  |
+---+-+--+-+-+---+
When I try to access the field ID shown above though,
it gives me error:
mysql select ID from Spot;
ERROR 1054: Unknown column 'ID' in 'field list'
This is kind of weird. I will really appreciate any
ideas
Thank you,
Kaustubh

	
		
__
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 


--
http://mike.kruckenberg.com | [EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Problem while insert binary

2004-05-25 Thread Michael Kruckenberg
giovanni cordeschi wrote:
Using PHP i'm not able to insert a binary variable into a field of type 
mediumblob of mysql.
The command I've used is:

$cfg_Query = Insert into  (operazioni, datacreazione) Values 
('.$contents.', Now());
$result = mysql_query($cfg_Query, $conn)
It doesn't appear there is a table name in your insert.
If that's not it you might try printing mysql_error() to pinpoint what's 
happening on the error.

Mike
--
http://mike.kruckenberg.com | [EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: DB hanging

2004-05-25 Thread Michael Kruckenberg
Brandon Metcalf wrote:
We are running 3.23.58 on Solaris 8 and seeing the following problem.
Periodically, mysqld gets into a state where we can't query just one
table in all of our DBs--queries just hang.  Restarting mysqld always
fixes the problem, but a SIGKILL is required to stop it.
Have you tried show processlist while this is happening? We've had this 
happen and most often it's someone or some script running a query with a 
missing join and killing the query fixes the problem.

Could this be something is corrupt in this particular table?  Would
dumping this DB and reloading it help?
Does check table indicate any problems?
http://dev.mysql.com/doc/mysql/en/CHECK_TABLE.html
Mike
--
http://mike.kruckenberg.com | michael at kruckenberg.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Posting Articles in Databases

2004-05-25 Thread Michael Kruckenberg
David,
MySQL is up to the task. Oodles of people doing this. We do something 
similar for course syllabi, thousands of documents (currently 113,676), 
both in XML and HTML, which can be as large as 100 pages when printed. 
I'm sure there are examples out there with more impressive statistics.

Mike
David Blomstrom wrote:
I finally got my PHP add/edit form to work. While
working on it, it occurred to me that I could use it
to post and modify more than bits of data in tables. I
could use it to make pages that people with no web
design skills can add articles to.
Most of my post focuses on PHP; my main question
regarding MySQL is this: Is it a good practice to use
MySQL databases for entire articles? By article, I
mean anywhere from two to over 100 paragraphs, along
with HTML coding and perhaps some images.
I know I haven't invented the wheel; I'm sure people
are already doing this or using a similar method. I'm
just new to this content management stuff, so I'm
just learning the ropes.
Anyway, this is my plan:
Suppose I put 50 pages focusing on the 50 states
online. But each page's body section is empty, except
for a link to a single cell in a MySQL table. The cell
corresponds with a field named Articles, and an echo
statement in the page's head section further specifies
a state (or row), such as Alaska.
Thus, a client could write an article about Alaska,
insert a couple images, then copy the HTML.
Next, he would access my add/edit page, click the
Alaska row and find the Articles cell/field.
Then he would paste the article into the cell and
submit it. He effectively created a web page focusing
on Alaska without REALLY creating or uploading a page.
Does this sound like a good idea, and is MySQL up to
the task?
Thanks.

	
		
__
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 
--
http://mike.kruckenberg.com | michael at kruckenberg.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Adding to a record

2004-05-25 Thread Michael Kruckenberg
Seems like you could do it either way:
PHP
?
$new_num = $mysql_num + $user_num;
mysql_query(update table set number = $new_num where . . .)
?
or
MySQL
?
mysql_query(update table set number = number + $user_num where...)
?
Depends if you want php or mysql to perform the calculation.
Daniel Venturini wrote:
Hello. Quick easy question I think? I display a INT value to a page (php) by
querying mysql. I want to be able for someone to put a new number and add to
that record. How would I go about doing this. Would this be a mysql command
or a php thing? Thanks in advance.
--
http://mike.kruckenberg.com | [EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Sorting Problem

2004-05-21 Thread Michael Kruckenberg
H Bartel wrote:
I have the following tables which look like this:
table tartist
++--+--+---+---+
| id | name | info | image | genre |
++--+--+---+---+
table programm
++--+---++
| id | date | stage | artist |
++--+---++
I want to be able to sort by stage and genre. Stage is no problem, since
it's kept in the programm table. Sorting by genre I believe could work
with a JOIN, but I have tried and didn't quite understand what and where
to join things here.
The idea is:
SELECT id, date, stage, artist FROM programm WHERE tartist.id=artist AND
tartist.genre=$genre;
In words:
Select every row from programm where artist matches the id in tartist
and where genre in tartist is of value $genre.
It seems the SQL isn't quite right here. Try something like:
select p.id, p.date, p.stage, p.artist from programm p, tartist t where 
p.artist = t.id and t.genre=$genre;

Mike
--
Mike Kruckenberg
[EMAIL PROTECTED]
http://mike.kruckenberg.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: copying longblob value to another table...

2004-05-21 Thread Michael Kruckenberg
Abubakr wrote:
 I am trying to copy a file stored in longblob column of a table to a 
longblod column of another table, can any one tell me what kind of 
insert statement should i use for that purpose.

You should be able to insert into your upload table with a select from 
your testing table. This doc explains the syntax:

http://dev.mysql.com/doc/mysql/en/INSERT_SELECT.html
 2ndly can any one tell me any built in function in mysql to download 
a file from longblob column to your local disk, i m aware of 'load_file' 
function to save a file from local disk to mysql DB but unable to find a 
function to download a file.

You can add 'into dumpfile' to the select to get blob data into a file:
select column into dumpfile 'filename' from  . . .
The SELECT doc gives more details:
http://dev.mysql.com/doc/mysql/en/SELECT.html
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: BLOB's - General Guidance

2004-05-19 Thread Michael Kruckenberg
In a lot of cases storing images on the filesystem makes the most sense. 
We store images in a database because we have multiple webservers that 
need to both read and write images. Keeping them in MySQL makes this 
easy. NFS isn't an option for us.

Having images in the database also makes scaling pretty simple in that 
we can add replicated slave machines for reading images.

David Blomstrom wrote:
--- Greg Willits [EMAIL PROTECTED] wrote:
On May 19, 2004, at 1:19 PM, David Blomstrom wrote:
All conventional wisdom I've ever come across for
this type of 
application is that there's no advantage to keeping
the image in the db 
itself. Just keep them as files on the server, store
a filename /or 
location in the db if necessary, and use your
middleware to display the 
images. Its faster, easier to maintain, and easier
to backup. IMO, 
storing images in the db just bloats the file and
complicates all the 
backup issues.

That's the advice I wanted to hear; one less thing for
me to learn. :)
Thanks.



__
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

--
Senior Programmer, Tufts University Sciences Knowledgebase
[EMAIL PROTECTED]
617.636.0959
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Installation of mysql-3.23.58 on Redhat 9

2004-05-14 Thread Michael Kruckenberg
There's a quick install guide on the MySQL site, which has most of what 
you've listed:

http://dev.mysql.com/doc/mysql/en/Quick_install.html
The INSTALL-SOURCE doc which comes in the tarball covers the process in 
great detail.

There may be others, those are two I've used.
Kamal Ahmed wrote:
All,
 
I am looking for a stepwise installation of mysql-3.23.58 on Redhat 9.
and have a hard time finding it on the MySql web site. Could someone
e-mail me the steps, please.
There should also be a section on installing databases, in order to make
sure that MySql is running and is operational
 
Thanks,
 
P.S as a sample, i am providing the following, which is good, but still
not complete.
 

Get the sourceballs
MySQL
current version: 3.23.58 
URL: http://www.mysql.com/downloads/ http://www.mysql.com/downloads/
...
 
Change into the MySQL source directory as follows;

#cd mysql-4.0.16
Follow this command by typing;
#./configure -prefix=/usr/local/mysql
-localstatedir=/usr/local/mysql/data -disable-maintainer-mode
-with-mysqld-user=mysql -enable-large-files-without-debug
#make 
#make install
MySQL is installed, 
#/usr/sbin/groupadd mysql 
#/usr/sbin/useradd -g mysql mysql
#./scripts/mysql_install_db

Then we make a couple minor ownership changes;
# chown -R root:mysql /usr/local/mysql
# chown -R mysql:mysql /usr/local/mysql/data
we use vi to add a line the ld.so.conf file as follows;
#vi /etc/ld.so.conf
And we add the following line;
/usr/local/mysql/lib/mysql

#/usr/local/mysql/bin/mysqld_safe -user=mysql 
#/usr/local/mysql/bin/mysqladmin -u root password new_password

 
Kamal Ahmed
Sr. Test Engineer
e-Security, Inc.
Enterprise Security Management
1921 Gallows Road, Suite 700
Vienna, VA 22182
phone: 703-852-8055
fax: 703-852-8010

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: ORDER BY Question

2004-05-12 Thread Michael Kruckenberg
Dirk Bremer (NISC) wrote:
The following query produces the following results:

select job_coop as 'Job/Coop', count(*) as Count from queue group by
job_coop;
+--+---+
| Job/Coop | Count |
+--+---+
| B03013   |19 |
| B05044   | 9 |
| B07037   | 6 |
| B15037   | 4 |
| B16032   | 6 |
| B17026   | 6 |
| B17056   |18 |
| B18032   | 5 |
| B20009   |31 |
| B21012   | 1 |
| B24026   | 8 |
| B25001   |42 |
| B27043   |10 |
| B27047   | 8 |
| B29064   | 6 |
| B31004   |61 |
| B36035   |60 |
| B36529   |54 |
| B38023   |38 |
| B38034   | 7 |
| B40020   |30 |
| D18032   |31 |
| D27047   | 2 |
| D31004   |59 |
+--+---+
Is there a way to use the ORDER BY clause to order the results by the
numeric value of the count(*), i.e. so that the results would be sorted by
the result of the count(*)?
select job_coop as 'Job/Coop', count(*) as Count from queue group by 
job_coop order by Count;

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: How to export data with no headers?

2004-05-10 Thread Michael Kruckenberg
Using --skip-column-names with the client or mysqldump suppresses the 
column names.

Cao, Wenhong wrote:

Hi All,

I am trying to export the records from the tables in the mysql database
into a file. The problem I am having now is that I don't know how to
export the records into a file without the header information, which is
the name of columns.
Can someone help?

Thanks,

Wenhong 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Importing at command line from text file

2004-05-10 Thread Michael Kruckenberg
Robert Ameeti wrote:
I'm a newbie trying to follow a tutorial. The tutorial says to type:

mysql employees employee.dat
The employee.dat file doesn't have to be in any specific location, as 
long as you can read it.

To run the command above, cd into the directory with the employee.dat 
file (maybe your home directory?) and issue the statement. You can also 
use an absolute path, ie:

mysql employees  /home/userid/employee.dat

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Directory Permissions on files

2004-05-08 Thread Michael Kruckenberg
Yes, the file permissions do affect whether the table can be updated. 
The files need to be writable (in the filesystem sense) by the user 
running mysqld.

By default MySQL creates directories umask 0700 and files 0660 unless 
the UMASK env variable is set differently when mysqld is started. If you 
chown to the user running mysql and chmod the files to an appropriate 
umask you should see this issue go away.

Robert Reed wrote:

Greetings,

I've recently inherited a FreeBSD server running MySQL
3.23.54.  It's good and stable.  I have a second
server that runs as a slave to the first.  Everything
goes smoothly until I make changes to a certain table
on my master.  This will kill the slave with the error
that this table is read-only.  These are all MyISAM
tables.  I noticed recently that the various
directories have different permissions and access
levels on them and wondered what the correct levels
should be.  And...does this even have an effect on
whether the table can be written to?
Thanks in Advance

=
Robert Reed
512-869-0063 home
512-818-2460 cell
	
		
__
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Export query to text file

2004-05-05 Thread Michael Kruckenberg
Add the -t option to ensure you're getting the table output stuck into 
your file.

mysql -t -uuser -N -eselect date_format('2004-02-29','%X')  sample2.txt

Yingyos wrote:
Hi Victor Pendleton ,

I type this command line.

mysql -uuser -N -eselect date_format('2004-02-29','%X')  sample2.txt
When i open in text editor,it show that '2004' only.
But i want format display on text file.

mysql select date_format('2004-02-29','%X');
++
| date_format('2004-02-29','%X') |
++
| 2004   |
++
1 row in set (0.00 sec)
How 's to do?

Thank you for reply again,
Yingyos  Santipasert
Victor Pendleton wrote:

mysql -uuser -N -eselect date_format('2004-02-29','%X')  sample2.txt
-Original Message-
From: Yingyos
To: Victor Pendleton
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 5/4/04 11:04 PM
Subject: Re: Export query to text file
Victor Pendleton wrote:

 

The `INTO OUTFILE` clause is expecting a table reference. An
  
alternatvie is
 

mysql -uuser -N -eselect now()  sample2.txt

-Original Message-
From: Yingyos
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 5/4/04 2:20 AM
Subject: Export query to text file
Hi,

I have MySQL 4.0.17 on Windows XP.
I use SELECT ... INTO OUTFILE print out query to text file.
If i write this command.
mysqlSELECT * from tbl1 INTO OUTFILE C:\\Query\\sample1.txt;

MySQL reponse OK.But i change command.

mysqlSELECT now() INTO OUTFILE C:\\Query\\sample2.txt;
MySQL response by exit from console.
How's to use SELECT ... INTO OUTFILE with datetime or another function.

Thank for the reply,
Yingyos Santiprasert






  


Hi Victor Pendleton ,

I want format on text file .

mysql select date_format('2004-02-29','%X');
++
| date_format('2004-02-29','%X') |
++
| 2004   |
++
1 row in set (0.00 sec)
How 's to do?

Thank you for reply again,
Yingyos  Santipasert




 





--
Senior Programmer, Tufts University Sciences Knowledgebase
[EMAIL PROTECTED]
617.636.0959
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Installing MySQL

2004-03-29 Thread Michael Kruckenberg
Yes. We do something like this to build packages from a local install.

./configure --prefix=/usr/local/mysql-4.018
make
make test
make DESTDIR=${HOME}/build/mysql/pkg install
Adaikalavan Ramasamy wrote:

Dear all,

Is it possible to install mysql locally on Sun Solaris 8 as I do not have
root permission ?
If so, what is the expected total size on disk and recommended steps
(./configure, make, make --prefix=/my/home/ install : is this sufficient)
?
Any hints or pointers are much appreciated. Thank you very much.

Regards, Adaikalavan Ramasamy

 



--
__
Senior Programmer, Tufts University Sciences Knowledgebase
[EMAIL PROTECTED]
617.636.0959


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]