mysql

zrm recovery into a file instead of a database from a snapshot

We have ZRM backups that are created using LVM snapshots. When we need to recover a database or two, we use mysql-zrm restore like this: mysql-zrm --action restore --backup-set backupSet1 \ --source-directory /var/lib/mysql-zrm/backupSet1/20060829140710 \ --databases "db1 db2" Is it possible to restore into a file instead of an act...

MySql Select problem

I need to do a select that select only the abv = "yes" and other filters,like: SELECT * FROM `business` WHERE `category` LIKE ('$_GET[search]%') OR `location` LIKE ('$_GET[search]%') OR `name` LIKE ('$_GET[search]%') OR `address` LIKE ('$_GET[search]%') AND `apv`='yes' This is not working, if I put it all AND does not return anything,...

Writing an RSS feed to MySQL using PHP

Basically I need to create a PHP document that will read an RSS feed and the write the information to a MySQL document. However I have very little experience in this area and I was wondering if someone would be able to provide an example of how to do this? I was thinking about something that incorperated MagpieRSS, however the documentat...

What is Mysql select statement to show a list of tables?

I want to write a program that can show the user a list of tables in the database and also show the descriptions of those tables. So can I do a "select * from system_table" or something like that? ...

Updating Linking Tables

I've currently adding a bit of functionality that manages holiday lettings on top of a CMS that runs on PHP and MySQL. The CMS stores the property details on a couple of tables, and I'm adding a third table (letting_times) that will contain information about when people are staying at the property. Basic functionality would allow the us...

How do I add more members to my ENUM-type column in MySQL?

The MySQL reference manual does not provide a clearcut example on how to do this. I have an ENUM-type column of country names that I need to add more countries to. What is the correct MySQL syntax to achieve this? Here's my attempt: ALTER TABLE carmake CHANGE country country ENUM('Sweden','Malaysia'); The error I get is: ERROR 1265 ...

MySQL schema to schema syncronization through triggers?

Quick note: I have 19 days to figure my client's problems out. Background: Client hired a contractor who boasted he could get a new App out the door in 3 months. Two months and some days later I'm brought in and the individual was let go; there is no complete code, no thought put into the schema, and an abomination for a UI. I hav...

How to select the desired result in MySQL?

setup: create table main(id integer unsigned); create table test(id integer unsigned,created datetime,text text); insert into main value(1); insert into test value(1,now(),'something1'); insert into test value(1,now() + interval 1 day,'something2'); Using: select main.id, text from main left join test on main.id=test.id grou...

Tomcat 6.0 manager authentication via JDBC realm

I wanted to configure Tomcat6.0 authentication via JDBC realm Configuration.** I checked following: -All my "users" and "roles" are stored in MySQL database. -MySQL JDBC drives are in tomcat\lib directory -Tomcat-user-xml is modified for such realm as below <-Realm className="org.apache.catalina.realm.JDBCRealm" driverName...

how to make it as one?

rechargedate | mobile | amount -------------+----------------+-------- 01-07-2009 | 0103001199 | 50.00 01-07-2009 | 0103001199 | 50.00 20-07-2009 | 0103001199 | 50.00 Above is a part of my data, now I want to make recharges of the same number on the same day become one row: rechargedate | mobile ...

PHP MYSQL timeout problem

I have an SQL query like this. When iam executing it though my php file it gives time out error. But when running the same query thoruhg php myadmin it gives results within seconds. SELECT cake_apartments.id, cake_apartments.Headline, cake_apartments.Description, cake_apartments.photoset_id, cake_apartments.Renta...

Rails: Can joins be merged when chaining scopes?

In a class A I have two scopes, s1 and s2 which both join over a table T using the exact same join columns: named_scope :s1 :joins => "JOIN T on T.id = A.t_id", ...some conditions named_scope :s2 :joins => "JOIN T on T.id = A.t_id", ...some other conditions Now, doing this fails: A.s1.s2.all Error: ActiveRecord::StatementInvali...

Syntax error with emulating "create user if not exists"

MySQL does not allow you to specify an if not exists clause in a create user statement (despite the fact that create table and create procedure do support this). There was a feature request for this in 2005 but the MySQL devs have done sod all about it, so it's probably not going to happen anytime soon: http://bugs.mysql.com/bug.php?id=...

how to detect and fix character encoding in a mysql database via php?

I have received this database full of people names and data in French, which means, using characters such as é,è,ö,û, etc. Around 3000 entries. Apparently, the data inside has been encoded sometimes using utf8_encode(), and sometimes not. This result in a messed up output: at some places the characters show up fine, at others they don't...

How to generically/dynamically create/drop users

(Related to, but separate from http://stackoverflow.com/questions/1502885/syntax-error-with-emulating-create-user-if-not-exists.) Is it possible to achieve the functionality of generically/dynamically adding a user (i.e. emulating the sp_adduser system procedure included with other DBMSs) in MySQL? MySQL doesn't support the following i...

Remote installation of Stored Procs on MySQL

I'm just setting up the live environment for my new project. Unlike my dev and testing systems, the live environment consists of a web server (Win 2003) and a separate DB server (MYSQL). My installation process for each release of the software is nicely scripted, giving me full rollback options etc. However, I can't work out how to ins...

Getting rid of duplicate results in MySQL query when using UNION

Hi everyone, I have a MySQL query to get items that have had recent activity. Basically users can post a review or add it to their wishlist, and I want to get all items that have either had a new review in the last x days, or was placed on someone's wishlist. The query goes a bit like this (slightly simplified): SELECT items.*, reacti...

Mysqli parameter binding issue

I need an extra set of eyes on this one. Any help will be greatly appreciated. This is a very simple search query, but for whatever reason I cannot find the bug. Well, I know where the bug is. I just can't get past it. Anyway..... I am taking a search value from a POST variable, setting that variable and then setting a column variable a...

Need help debugging: Having trouble getting data to Silverlight App through RIA Services, Entity Framework, MySQL

I'm trying to build a Silverlight App that accesses and presents data from a MySQL database. I'm trying to use Entity Framework to model the MySQL data and RIA Services to make the data via EF available to Silverlight. My Silverlight App is showing the correct columns in the datagrid, but it does not show the data (alternate link to im...

How to measure current load of MySQL server?

How to measure current load of MySQL server? I know I can measure different things like CPU usage, RAM usage, disk IO etc but is there a generic load measure for example the server is at 40% load etc? ...