mysql

php mysql date/time question

I've built a small application which has User Management, a frontend console to enter data and a backend console to control parts of the frontend. The frontend adds rows to a MySQL database which are timestamped. The backend needs to be able to select rows from the database between X and Y dates. Everything works so far, except the date...

MySQL - how to SHOW PROCESSLIST only with current user's processes?

Is there a way in MySQL 5 to show only the current user's processes(queries)? The user has the PROCESS privilege, therefore SHOW PROCESSLIST displays running processes of all users. According to the documentation, SHOW PROCESSLIST does not allow any kind of WHERE syntax, nor did I manage to make it into a subquery. Of course, I could s...

Repository of BNF Grammars?

Is there a place I can find Backus–Naur Form or BNF grammars for popular languages? Whenever I do a search I don't turn up much, but I figure they must be published somewhere. I'm most interested in seeing one for Objective-C and maybe MySQL. ...

Compare result of 'as' expression in 'where' statement.

Is it possible to create a MySQL select statement that uses an expression as x then checks if the value for x is under a certain amount? SELECT (mytable.field1 + 10) AS x FROM `mytable` WHERE x < 50; ...

MySQL Composite PK with Nullable FKs

First off, let me preface this question by stating that I'm really a pretty terrible data modeler. I know only enough to be dangerous. The table I'm building has four foreign keys, two of which reference the same table. Here's the create statement for that table. CREATE TABLE IF NOT EXISTS `abnr`.`reputation_event_log` ( `id` INT ...

Negate Regex in MySQL rlike Expression

I want to match any line that does not end with 'CA' or 'CA[any number]'. How can I do that using rlike in MySQL? (Note it doesn't support ?! etc). Here's the regex for a positive match, I just need a way to negate it: '^.*[C][A][0-9]?$' (Due to an embarrassing architecture limitation, I don't want to use not rlike ...) ...

what is the best way to use c# with mysql without using odbc

I need to access a mysql database from c# but I would prefer to go directly there and not use odbc. I have to create a demo and I am using xampp on a usb drive and my data stuffer is written in c#. So to keep the usb drive isolated from the computer that the demo runs on. I am moving away from odbc because of setup reasons. ...

Communication between AS3 and MySQL server

Hello all, I'm developing a game coded in Flash AS3 and need to read/write info to an SQL server. Currently, for testing purposes, I use ASQL which is very simple and robust, but it needs a direct connection from the client machine to the SQL server (port 3306 open and allowing wildcard username to connect from anywhere using a passwor...

What function to use to hash passwords in MySQL?

I have a user table in my mysql database that has a password column. Currently, I use the MD5 algorithm to hash the users' password for storage in the database. Now I like to think that I am a security conscience person. I noticed while reading the MySQL docs that they don't recommend MD5 or the SHA/SHA1 hashing methods, but don't offer ...

Providing MySQL users with just the minimum privileges

For a web application, when creating the user which will connect to the MySQL database, you have the choice of privileges. Assuming that the only actions intended to be done by that user are SELECT/INSERT/UPDATE/DELETE, it seems to make sense to only provide those privileges, however I've never seen that recommended anywhere - what are t...

PHP mySQL - When is the best time to disconnect from the database?

I use lazy connection to connect to my DB within my DB object. This basically means that it doesn't call mysql_connect() until the first query is handed to it, and it subsequently skips reconnecting from then on after. Now I have a method in my DB class called disconnectFromDB() which pretty much calls mysql_close() and sets $_connected...

VS 2008 Team Suite Database GDR - MySQL Provider

I've had a look on google for alternate providers for the new GDR but couldn't find any. Does anyone know of a MySQL project that is attempting to create a provider? ...

MySQL versus SQL Server Express

Did the recent purchase of MySQL by Sun and the subsequent buggy releases kill the MySQL brand? I whole heartedly embraced MySQL when it first came out as I used to be a poor developer and all the RDBMs were too expensive. I have fond feelings for MySQL and their being able to compete with Oracle and SQL Server. I credit the original ...

How do I archive a MySQL databases?

I have a MySQL database that I want to archive. What is the best way to do this? Note: I don't want to just do a backup. I want to do a one time export of the data for long term storage in a way that I can get at on a later date. Particularly, I want to not be tied to MySQL, a database or preferably any given software (I'd really like i...

Is mergeing of these (long) mysql queries possible?

Okay, my dilemma is this. I have an admin page that I use to get a summary of the day's submissions to one of my sites. This sumamry page pulls data from several tables, some of which store the actual media data, others store the website urls, ids and owners, and another table stores the day-to-day stats to calculate in/out ratios for ea...

MySQL SQL query profiling and query cost tools and techniques

Hi, Working with Microsoft SQL Server I found extremely useful SQL Server Profiler and Estimated Execution Plan (available in Management Studio) to optimize queries during development and production system monitoring. Are there similar tools (open source or commercial) or techniques available for MySQL? ...

Which version is my MySQL Server?

What's the query syntax to determine the exact version number of the MySQL server software? ...

MySQL flush tables - Current database or every database?

Does the MySQL command : FLUSH TABLES; flush every table in the current database, or every table on the server ? I'm using MySQL 5.0 - the documentation is unclear, although it does mention that : FLUSH TABLES WITH READ LOCK; will do so for ALL databases. Thanks. ...

MySQL: "Column 'column_name' in where clause is ambiguous"

I JOIN 2 tables for example table_A +---------+-----------+-----------+ | user_id | ticket_id | user_name | +---------+-----------+-----------+ table_B +-----------+-------------+ | ticket_id | ticket_name | +-----------+-------------+ If I run the following query: SELECT table_A.user_id , table_A.user_name , table_B.ticket_na...

How to get a row-by-row MySQL ResultSet in python

MySQL ResultSets are by default retrieved completely from the server before any work can be done. In cases of huge result sets this becomes unusable. I would like instead to actually retrieve the rows one by one from the server. In Java, following the instructions here (under "ResultSet"), I create a statement like this: stmt = conn.cr...