mysql

How to determine if MySQL collation is case sensitive or not?

Hi there, I know most MySQL instances out there 'act' case-insensitive by default. But I know that you can use a case sensitive collation if you want to. Know would there be a function to check if the collation is case sensitive or not? The problem I want to fix is that if you use LOWER in queries, MySQL can't use an index, even though...

Is there any way to know what cache size is needed?

I am using mysql as a db. Is there any formula for determining the cache size needed to cache the results? Thanks ...

How much of this task can/should be done in SQL?

I have a database where I would like to construct a result that match my indata. Explanation of examples: "Indata" is a row with criteria for the filter in step #1, see below. "Results after filter #1" is the rows left after step #1 "Results after filter #2" is the rows left after step #2 "Print for indata 1" is the end result, presenti...

Is MySQL more resistant to SQL injection attack than PostgreSQL (under Perl/DBI) ?

I am reviewing a Linux based perl web application that contains a login handler with the ubiquitous my $sth = $DB->prepare("SELECT password from passwords where userid='$userid'") or die; $sth->execute or die; ... where $userid is initialized from (unsafe, unfiltered) web user input. It is well known that the DBI documentation recomme...

Why this is not valid MySQL query?

mysql> ALTER TABLE bdds_arts ADD test VARBINARY; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 something wrong with varbinary type? here is output of mysql --version mysql Ver 14.12 Distrib 5.0.24a, for Win32 (...

MySQL: Calculate the difference between Date/Times - only during M-F "Work week"

I need to calculate a difference between a starting date/time and an ending date/time. But, I only want to do this for the 5-day work week (exclude Sat/Sun as days). What is the best way to do this? My thought is that from the date, I'll have to get the day of the week and if it is a weekday, then I add to the accumulator. If it's no...

What if I delete ibdata1 in mysql (LINUX)

Hi, I am using LINUX and I have mistakenly deleted ibdata1 file in mysql folder. I restarted the 'mysqld' service and Now when I am trying to read data from the databases it is not able to find out older tables. Am I in a big trouble? Please throw some light on this if any idea. Thanks for your time. Thanks and Regards, SachinJadhav...

Selecting rows - unique field as criteria

Having this table: Row Pos Outdata Mismatch Other 1 10 S 0 A 2 10 S 5 A 3 10 R 0 B 4 10 R 7 B 5 20 24 0 A 6 20 24 ...

Mysql highest from 1 row

Is is poslbe too get the highest value from a row? IE. I have 3 days as columns with a timestamp value, can i get the highest value out? ...

Connect to Database in Object oriented PHP

How can I create a class in oo php wherein that class will be the one that will manage the DB connection? Sample codes or sites will do. Im using MySQL Command Client by the way. Main problem: How can I connect to the DB so that I can insert new records, retrieve records, update records? Thank you! ...

Compatible and recommended data types for MS Access frontend / MySQL backend

I need a list of recommended MySQL data types to use when using Microsoft Access as the front end. Can anyone point me to a succinct article on the net, or post a list here please? ...

Why do MySQL InnoDB inserts / updates on large tables get very slow when there are a few indexes?

We have a series of tables that have grown organically to several million rows, in production doing an insert or update can take up to two seconds. However if I dump the table and recreate it from the dump queries are lightning fast. We have rebuilt one of the tables by creating a copy rebuilding the indexes and then doing a rename swit...

PHP Multiple Dropdown Box Form Submit To MySQL (Part 2)

This is a continuation of the discussion at http://stackoverflow.com/questions/944158/php-multiple-dropdown-box-form-submit-to-mysql which ended with the words: "Once you have the variables, it is trivial to create new rows." No doubt that's generally true, but apparently not for this learner... :-D Given the following form: <f...

saving hebrew utf8 to database with php

when saving hebrew to a mysql database (utf-8) i am getting it converted to something like this: &times;&uml;&times; editing content directly in the database works and it outputs on the page fine too. sorry forgot to ask a question... what am i doing wrong!? ...

Interpreting coded field in SQL

Having this table, I would like to find the rows with Val fitting my Indata. Tol field is a tolerance (varchar), that can be either an integer/float or a percentage value. Row Val Tol Outdata 1 24 0 A 2 24 5 B 3 24 10 C 4 32 %10 D 5 32 1 E Indata 30 for example should match rows 3 (24+10=34) and 4 (3...

How do I go about handling the shifting of news articles in regards to main, featured, and category areas?

Consider a template such as this ( questions posted below ): Let's say I posted an article about the Superbowl and tagged it in the Sports category. In my articles table I have a flag for featured or not, and a flag for main article. So if I check the main flag it shows up as the main article. If I post another main article a day late...

Checking MySQL Logs for Possibility of Performance Issues/DOS attack

Hello, We write a most of our websites in PHP and use MySQL database connections routinely. We are currently encountering a major performance issue on our dedicated server. When accessing our server it loads webpages very slowly and SSH'ing into the machine takes forever. We have restarted it a few times and after a few minutes that pro...

Best way to do a MySQL large database export

I've usually use mysqldump to export a database. However, when the database is really large, it seems much faster and less intensive to just gzip the database files directly without involving the MySQL deamon and copying that to the other database. eg: tar -czvf {db_name}.sql.tgz /var/lib/mysql/{db_name} Is this a good method of do...

I'm having a problem with unsigned data types iwith SubSonic 3 and MySQL

Hello, I know others have "found" the issue an indeed I know where the issue is but it would be nice if the fix was posted as per the second link. http://stackoverflow.com/questions/1802095/subsonic-mysql-unsigned-bigint-and-bit-issue http://stackoverflow.com/questions/1283615/subsonic-object-of-type-system-uint64-cannot-be-converted-to...

MySQL Trigger only for a certain mysql user

I'm trying to find out if a specific MySQL User is still in use in our system (and what queries it is executing). So I thought of writing a trigger that would kick in anytime user X executes a query, and it would log the query in a log table. How can I do that? I know how to write a query for a specific table, but not for a specific us...