mysql

rake db:create - collation issues

kratos-iii:railsproj zachinglis$ rake db:create (in /Users/zachinglis/Sites/rails/railsproj) Couldn't create database for {"adapter"=>"mysql", "host"=>"localhost", "username"=>"root", "password"=>nil, "database"=>"railsproj_development"}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a mat...

MySql and Wordpress query syntax

I'm trying to learn MySQL queries for use with Wordpress.... What I do know is this query, which gives all instances of the custom field "description" the value of "test" if the field is NULL UPDATE `wp_postmeta` SET `meta_value` = 'test' WHERE `meta_key` LIKE 'description' and `meta_value` is null What I need to do is change that so...

Ensuring uniquness of a MySQL key

Hi, I have a MySQL DB where a key (a string) is read from a third pary source. However, these are not always guaranteed unique (they're movie titles). So I need to check for key uniqueness, and if not unique, amend it to make it unique - by adding an incremental count at the end of the key for example. What's the best pattern to do thi...

Is there a MySQL feature like SQL Server's TIMESTAMP column?

My preliminary research says "no". I have a database app in SQL Server that uses the SQL Server timestamp column for tracking changes.... that is, I can go through the table and know that if I see a timestamp > than some reference timestamp, that the row has been added or updated. I'm looking for a type like that in MySQL. It doesn't ...

How to update a relational table ?

I've 3 tables. Users (id, mail, username, etc..) Practices (id, name) UsersPractices (userId, practiceId) The last one is the relational table which is n-n. I'd like to update this one, depending on the user's will. It means, that he could want to add, or remove some his practices. What algorithm could i use to do this ? Should i...

Problem persisting a java.util.Date into MySql using Hibernate

I've been debugging this problem for the last couple of hours with no success and figured I'd throw it out to SO and see where that goes. I'm developing a Java program that persists data into a MySql database using Hibernate and the DAO/DTO pattern. In my database, I have a memberprofile table with a firstLoginDate column. In the databa...

MSSQL, Joomla and IIS7

Is there a MSSQL Provider for Joomla? I know that there is a MSSQL Client for PHP in beta and I wonder whether it would be hard to change the database provider to point to MSSQL instead of MySQL. ...

Is there a PHP/MySQL database admin that doesn't use sessions?

I am doing development work on a site with a strange server set up where sessions basically don't work. It's kind of a long story, but the main crux is it's a cluster of servers that are syncronized from an FTP server every few minutes. And for example, anything written to the filesystem in PHP gets deleted within 5 minutes. So this mea...

PHP/MySQL - SELECT from various tables, with a list of indexes

Hi folks... im with a hugh question... Here is the scenario. Im developing a timeclock system, i have these tables: -punch (id_punch,date) -in1 (id_in1,time,id_punch,...) -in2 (id_in2,time,id_punch,...) . -in6 (id_in6,time,id_punch,...) -out1 (id_out1,time,id_punch,...) -out2 (id_out2,time,id_punch,...) . -out6 (id_out6,time,id_punch...

asp.net (mvc) and mysql, what am I getting in to here?

I'm building asp.net mvc app, and I want to know the ramifications of me switching from sqlserver2008 to mysql? Apart from some syntax tweaks, what other things should I am taking into consideration (technically speaking ofcourse) if I want to move over to use mysql? convert sprocs to inline queries transaction and locking maybe hand...

Cant make field unique!

Can you not have more than 2 unique fields in a table or am i doing something wrong here? I have 1 unique key for username and i want it for email too but i get #1062 - Duplicate entry '' for key 'email' alter table users add unique (email) Tbl: `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(255) NOT NULL, `...

C# handle multiple database types?

I have an app that needs to be able use either an sqlite3 datebase or an mysql database. The customer wants to be able to choose between the two (obviously one would be local and one would be online). My thoughts for doing this would be by creating a database interface that has all of the common methods (ExecuteReader, ExecuteScalar, et...

Given a date, how to get next and previous date in database

I have a database with a bunch of dates. I would like to, given a date, get the next date in the database and previous date in the database. So given a databse with 10/10/09, 10/12/09, and 10/15/09, if someone enters the date 10/13/09, it should return 10/12/09 as the previous date and 10/15/09 as the next date. How can I do this? Than...

Scheduling Script with PHP/MySQL - Help with Logic

Hello all, I'm looking to develop a small script where users can insert their "schedule." However, I need some help determining the logic of how to create the DB structure and how to input the "time" of the events in the database. One thing to note, however, is that when users enter their "schedule", they will not be entering exact da...

MySQL Full text boolean search with tags

I've never done searching from MYSQL before, but I need to implement a search. I have three tables, 'articles', 'articles_tags', and 'tags'. 'articles' holds the first thing I would like to search on, the 'title' field. 'articles_tags' is a pivot table which relates 'articles' and 'tags' together. 'articles_tags' has two fields: 'arti...

MySQL Ruby Gem on OS X Snow Leopard

I've been fighting with getting the MySQL Ruby Gem up and running on Snow Leopard for the past couple of days. I have tried all different sorts of things to get this working, and currently have MySQL 5.1.37 x64 installed. After fighting to even get the Gem installed I believe that I finally got it installed, but whenever I attempt to ac...

Fork MySQL INSERT INTO (InnoDB)

Hello, I'm trying to insert about 500 million rows of garbage data into a database for testing. Right now I have a PHP script looping through a few SELECT/INSERT statements each inside a TRANSACTION -- clearly this isn't the best solution. The tables are InnoDB (row-level locking). I'm wondering if I (properly) fork the process, will ...

Selecting a range of rows using 3 different indices

My database looks like this: Book,Chapter,Verse,Scripture "1","1","1","1text1" "1","1","2","1text2" "1","1","3","1text3" "1","1","4","1text4" "1","2","1","2text1" "1","2","2","2text2" "1","2","3","2text3" I want to select all the rows from 1,1,1 to 1,2,3. However my current query will not return row 1,1,4 because 4 is greater than 3....

MySQL to SQL Server 2005

How can I convert a database from MySQL to MS SQL Server 2005? ...

What is binlog in mysql?

I've set mysql parameter innodb_flush_log_at_trx_commit=0. It means that mysql flushes transactions to HDD 1 time per second. Is it true that if mysql will fail with this flush (because of power off) i will lose my data from these transactions. Or mysql will save them in data file (ibdata1) after each transaction regardless of binlog flu...