mysql

What is the mysql command to pipe all command line input to a file on Fedora OS?

I run several queries from mysql command line on my linux box (Fedora Os). I would like to capture all these automatically to a file. I know there is command in Linux called history and then you can pipe it to a file. Is there anything similar for MYSQL. I would like to save all my scripts and sql query just for reference sake at a later...

does mysql 5.4 has a linux 32 bit version?

Can MySQL 5.4 beta be compiled for 32-bit processors under Linux? ...

PHP: mysql_fetch_array() in a while-loop takes too long

I am creating an online calendar for a client using PHP/MySQL. I initiated a <table> and <tr>, and after that have a while loop that creates a new <td> for each day, up to the max number of days in the month. The line after the <td>, PHP searches a MySQL database for any events that occur on that day by comparing the value of $i (the c...

How to store approximate dates in MySQL?

I need to store dates such as 'Summer 1878' or 'Early June 1923', or even 'Mid-afternoon on a Tuesday in August'. How would you suggest I do this? I have considered breaking the date and time up into separate (integer) columns, and giving each column an ancillary (integer) column containing a range (0 if exact; NULL if unknown). But I...

mysql syntax problem

I'm trying to display info from a mysql row on this page. I'm using $_GET, because the id is included in the link to the page: www.example.com/page.php?id=1 but it returns this error: Error : 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 '= '1'' at l...

Help with MySQL gem on OSX

I'm trying to get the mysql gem working on OSX 10.5.6, and feeling stymied. % gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config Building native extensions. This could take a while... Successfully installed mysql-2.7 1 gem installed % irb -rubygems -rmysql irb> Mysql.init dyld: lazy symbol binding failed: Symbol...

How do I list related blog posts ordered by the number of common tags?

I want to display a list of related blog posts and I want the list to be ordered by the number of common tags they have to the current post. Each post can have multiple tags associated to it. Here is my table structure: [Posts] <-- [posts-to-tags-joining-table] --> [Tags] I'm using PHP and MySQL - can I do this in one query? ...

MySQL pagination without double-querying?

Hi all, I was wondering if there was a way to get the number of results from a MySQL query, and at the same time limit the results. The way pagination works (as I understand it), first I do something like query = SELECT COUNT(*) FROM `table` WHERE `some_condition` After I get the num_rows(query), I have the number of results. But th...

How to create igoogle layout(drag & drop & store) using PHP and AJAX?

In igoogle, we can drag & drop the modules and then if we quit the browser and open it again, the position of each module still the same. I have tested couple of things: When not logged in, igoogle store the modules position in my cookies(cache). Because if I clear cache, it goes back to original position. When I logged in, after posit...

Web-Based Music Library (programming concept)

So, I've been tossing this idea around in my head for a while now. At its core, it's mostly a project for me to learn programming. The idea is that, I have a large set of data, my music collection. There are quite a few datasets that my music has. Format, artist, title, album, genre, length, year of release, filename, directory, just...

Inner Join Question

CREATE TABLE college ( id SERIAL PRIMARY KEY, SCHOOL VARCHAR(100), CColor VARCHAR(100), CCmascot VARCHAR(100) ); CREATE TABLE mats ( id SERIAL PRIMARY KEY, CColor VARCHAR(100), CCNAME VARCHAR(100) ); MYSQL Ok so here is the problem I think its pretty simple ...

Looking to build myself a tiny, free VMWare image for PHP+MySQL Development.

I'm looking to build myself a VMWare image for PHP+MySQL Development. At present I'm using an ubuntu image which takes ~1 GB of my hard drive space. I'm looking to replace it with something smaller and lighter. So, I'm curious... What do you folks use? It doesn't matter what OS / webserver as long as it's running Php 5 and MySQL. The ...

NHibernate won't decode UTF-8 from MySql

Hey, I have populated a MySQL table with utf-8 strings (using a python script). You can assume that the string in the DB was correctly encoded (I've verified this by extracting the string from MySQL Query Browser and running a utf-8 decode... got my original unicode string). Now the problem begins when I try to load this string using N...

Never delete entries? Good idea? Usual?

I am designing a system and I don't think it's a good idea to give the ability to the end user to delete entries in the database. I think that way because often then end user, once given admin rights, might end up making a mess in the database and then turn to me to fix it. Of course, they will need to be able to do remove entries or a...

Strange Mysql Query Performance on View

I have a view : vcompanyendofday The following query executes in just 0.7 secs Select * from vcompanyendofday But a simple where condition to this query takes around 200.0 secs select * from vcompanyendofday where companyid <= 51; This is the view definition: CREATE VIEW `vcompanyendofday` AS select `c`.`companyid` AS...

Linking / Synchronising SQL DB with MySQL DB

I have a need to access data in a MS SQL database from within in MySQL and would like to know my options. The data is held across various joined tables Ideally I would like to mirror the database schema and data in MySQL so that it can be queried from within Wordpress. The data is hotel information as seen here http://www.vrxstudios.co...

first mysql trigger failing

Ok, I've started writing my first trigger in mysql, it doesn't give an errors, but it doesn't work either... DELIMITER $$ DROP TRIGGER `cc`.`update_expires_date_trig`$$ CREATE TRIGGER `update_expires_date_trig` BEFORE INSERT ON `credit_test_acc` FOR EACH ROW BEGIN UPDATE credit_test_acc SET date_expires_acc = DATE_ADD(CURDATE(), ...

Group by 'other', where groups with small contribution are included in 'other' field - MySQL

I would like to GROUP BY an item in my table, which has an associated monetary value. This I can work out as a percentage, however there are often too many items in the list (too many to be useful, for example in a graph). Consequently, I would like to put those items that have a contribution to the total of less than say 5% into an 'Oth...

PEAR MDB2 executeStoredProc and returning a result set. Possible? Worth it?

Hi, I've been trying to make this work for the last couple of hours. I have a simple stored proc called get_log_entries: CREATE DEFINER=`root`@`localhost` PROCEDURE `get_log_entries`(p_min_id INT) BEGIN SET p_min_id = IFNULL(p_min_id, -1); SELECT * FROM db_log WHERE item_id > p_min_id; END It's dead simple and it returns results ...

Importing all MySQL databases

I mysqldump --all-databases nightly as a backup. But on importing this dump into a clean installation, I obviously run into a couple issues. I obviously can't (and don't want to) overwrite the new information_schema. All my users and permissions settings are lost, unless I overwrite the mysql database. What is standard practice in th...