mysql

How to Exclude Data for Specific Tables

I am using mysqldump to create a canonical installation script for a MySQL database. I would like to dump the data for able half of the tables in the database, but exclude the data from the other tables. I am aware of the following two commands: --no-data --ignore-table But the first applies to all tables, and I believe the second exc...

Launchd and user mappings

Hello. I'm trying to get MySQL to run under launchd so I set up a launchd item including a "UserName" key with "mysql" as value. I did this because when I start mysql I usually go: mysqld_safe --user=mysql. When I load it, I get: 10/22/10 11:13:02 AM com.apple.launchd[1] (com.mysql.mysqld463) Suspicious setup: User "mysql" maps t...

Using mysql_* functions with a mysqli connection

I was wondering if the older mysql_* functions provided with php will work with a mysqli connection. ...

php image manipulation help or class?

im really having a tough time trying to upload images using php and mysql, and i really need help! this is what i want to do in natural language: 1. upload an image 2. check if format is okay(png, jpeg, gif) 3. rename the image file, so theres no ambugity in this format(eg. pic-$userid.gif) 4. upload the pic to the images/folder 5. an...

How can I optimize my database?

Hi, I am creating a platform for some clients. Each client needs to have contacts and manage them in groups, categories (which depends of the group) and subcategories (which depends of the category). The database is going to be very big, and Im afraid about the performance. I want to optimize the database; now, I have these options: M...

mysqldump Fully Qualifies Triggers with Database Name

I'm am trying to use mysqldump to export a database which needs to be imported using a different database name. Looking at the SQL generated by mysqldump, it appears that triggers are the only object names which are fully-qualified with the source database name thus foiling my needs. Is there anyway to direct mysqldump to not fully-quali...

MYSQL user statistics query help?

I have a table (statistics) with the columns User, Date (datetime), Page and IP. I have this query: SELECT * FROM statistics WHERE page LIKE '%page_name' ORDER BY date DESC LIMIT 30. That's ok to display all the user that visited that page. But I would like to display unique ips per day, something like DISTINCT ip (per day) I don't k...

MySQL PHP: WHERE everything except..

How can in a query, SELECT * WHERE type = is everything except "news"? Or should i check that later in the while()? ...

MySQL Order of Operations?

Hi All! Is there a definitive place to find order of operations for mySQL statements? Is the below order correct? FROM clause WHERE clause GROUP BY clause HAVING clause SELECT clause ORDER BY clause If this is the case, can I use a term defined in the SELECT clase (select first_name as "f_name") within the group by clause? Thanks! ...

Storing JSON in MySQL?

I have some things that do not need to be indexed or searched (game configurations) so i wa sthinking of storing json on a blob. is this a good idea at all? or are there alternatives? ...

JDBC result set for code connecting Java and MySQL

I am trying to connect to a MySQL database using Java. I want to grab all the entries for two row from two rows in a database and put them into the class ExpertScore. I then want to put the newly created ExpertScore objects into an array of ExpertScore objects. After this I want to run them through a method that takes an array of ExpertS...

How to use database as backup/failover in hibernate?

Hi, My application is based on the hibernate to fetched data from a mysql server. This mysql server is replicated to another mysql server instance. Today, I got a downtime as the primary database server was gone down without any notice. To avoid any future accidental problem, I am planing to add a functionality that will enable system t...

Group SQL results by week and specify "week-ending" day

I'm trying to select data grouped by week, which I have working, but I need to be able to specify a different day as the last day of the week. I think something needs to go near INTERVAL (6-weekday('datetime')) but not sure. This kind of SQL is above my pay-grade ($0) :P SELECT sum(`value`) AS `sum`, DATE(adddate(`datetime`, I...

Single text field for database query

I need to be able to enter any the following types of information into into a single text field. customer name (ie first and last name). customer phone number. (including area code) customer email address. customer service ticket number. customer product serial number. How it works so far is that I have 5 different PHP files on...

Can't Start MySQL Server 5.1 As A Service On Windows XP SP3

I've had MySQL running as a service on my Windows XP SP3 development desktop, but I can't start it now. I'm trying to get Python's MySQLdb module working. When I got a "no module named _mysql" message, I found out that I didn't install the MySQL C header files, so I downloaded the MySQL 5.1 .msi and ran it to add the C header files to ...

How to specify an auto-incrementing (int) identity column using Fluent-NHibernate and MySQL

The title basically says it all... I'm trying to specify an auto-incrementing (int) identity column using Fluent-NHibernate and MySQL. I've tried the following variations... Id(x => x.ID).GeneratedBy.Native(); Id(x => x.ID).GeneratedBy.Identity(); Id(x => x.ID).GeneratedBy.Increment(); ...and tried setting default values on eac...

Is there anything wrong with this mysql trigger?

I have a product, sales_order, and sales_order_product table. The nature of the products dictate frequent changes to price and weight. The customers often times save orders for a few days before submitting and paying for them. Because of this lag and the price/weight fluctuations, we allow them to freeze in the price/weight at the ...

mysql rename table column name

How to rename the table field in table xyz, Fields are manufacurerid,name,status AI,PK,int Want to rename to manufacturerid , I tried using phpmyadmin panel , its not working, show error, MySQL said: Documentation #1025 - Error on rename of '.\shopping\#sql-c98_26' to '.\shopping\tblmanufacturer' (errno: 150) ...

left join with condition for right table in mysql

Hi, I have been trying to wrap my head around this issue but I am not making much progress. My goal is to do a left join between two tables with criteria for the right table. I would like to see the list of all products and prices for the current day even though there is no pricing row for the current day. Here is an example of the c...

howto get php PDO QUERY resultset in single array instead off nested in one

I needed to change a query into a JOIN of two tables. $q = "SELECT * FROM table1 AS a JOIN table2 AS b USING(id) WHERE a.id= $id"; $stmt = db::getInstance()->prepare($sql); return $stmt->fetchAll(PDO::FETCH_ASSOC); All off the sudden I cannot refer to each row value with $rows['value'] ,BUT I need to use $rows[0]['value']. How can I ...