MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

5
votes
1answer
396 views

MySQL Replace — Query or in Shell?

I have numerous tables with some funky character replacement going on. I found some information on running an update to replace these, but it's in numerous tables and numerous fields. update ...
6
votes
1answer
396 views

Application Settings in Database

In the past I have stored all generic settings and configuration items such as: custom application title, home address, version, debug, etc.. all in a "settings.php" file that I would include into all ...
3
votes
1answer
5k views

MySQL : if server_id is not explicitly set, then get error `ERROR 1200 (HY000) at line 1: The server is not configured as slave;`

Our mysql version is "mysql Ver 14.14 Distrib 5.1.35, for portbld-freebsd7.2 (amd64) using 5.2" We have two database servers with replication, in a simple master/slave relationship. mysql2 is the ...
6
votes
1answer
2k views

COUNT(*) on InnoDB whenever phpMyAdmin loads

It's a known issue that innodb is slow in SELECT count(*) FROM Table Hence I avoided that. But I notice that whenever I login to phpmyadmin, it will automatically execute a count(*) for my innodb ...
12
votes
1answer
3k views

Is it possible to have passwords configured per database or per host in .my.cnf

I have the following in my ~/.my.cnf [client] password="somepass" but this is not the password I use for every user@host/database I connect to. Is there some way to specify in the config different ...
8
votes
4answers
1k views

How can I optimize this MySQL query further?

I have a query that is taking a particularly long time to run (15+ seconds) and it is only getting worse with time as my dataset grows. I have optimized this in the past, and have added indices, ...
2
votes
1answer
106 views

MySQL user account 'From Host' setting

I've just installed Wamp server 2 and I get the following 4 default MySQL users: USER FROM HOST <anonymous> localhost root localhost root 127.0.0.1 ...
7
votes
3answers
192 views

Is there a performance gain by handling data with stored procedures versus feeding it into functions after retrieval?

Title sums it up. I'm reasonably well off with PHP, and comfortable getting it to do what I need it to with values pulled from MySQL, however in the interest of expanding my knowledge I've been ...
1
vote
1answer
254 views

InnoDB Foreign key updating vs. manual in-application updating

I've been working on a "legacy" schema in MySQL Workbench that uses a lot of relations. All of the tables are MyISAM, however, and there are no foreign keys. However, I'm working on a new area of the ...
2
votes
1answer
398 views

Lost tables in Drupal site database

I have Drupal site on my local server build using pressflow I had problems with the xammp 1.7.4 server, so I delete everything except mysql and htdocs folders. I installed the server again, but the ...
3
votes
2answers
10k views

MySQL tables do not show up in the phpMyAdmin and MySQLWorkbench

I just setup the phpMyAdmin and I have this problem: When I login, I can't see any tables. I had tried this with MySQLWorkbench and I got the same result. Any suggestions ?
2
votes
2answers
172 views

MySQL Query Optimization : Bets and Averages

I have the following selection string: SELECT * , AVG( `q1` ) AS betavg, COUNT( bet_id ) AS nr, MAX( q1 ) AS qmax, (MAX( q1 ) - AVG( `q1` )) AS diff FROM jos_bet_1x3_best GROUP BY `bet_id` HAVING ( ...
4
votes
3answers
1k views

MySQL Query Optimization : Indexing and Pagination

I'm adding pagination to my 'latest news' php script and running in to an issue. SELECT sid, title, time, bodytext, author, url FROM news WHERE approved=1 ORDER BY time desc LIMIT $start, $limit I ...
1
vote
4answers
439 views

Best way to automate running several MySQL commands

We have several core db tables on our system and allow our employees access to these tables via views that just show them the data they need to see. We created these views in a new db specific to ...
4
votes
2answers
6k views

Best Book to Learn MySQL [closed]

I would like to read a book about MySQL database with emphasis on performance and optimization on Linux server. I appreciate your suggestions.
4
votes
4answers
3k views

Storing arrays of integers in database (for efficient select)

I am creating a database that will store 100.000 (and probably more in the future) users. While this obviously happens in a table with 1 row per user, every user can (and will) store hundreds of ...
13
votes
1answer
350 views

Does anyone have a good recommendation for a book which teaches sharding?

Does anyone have a good recommendation for a book which teaches db sharding (from scratch at best) I have read like 40 different websites talking about sharding. I'm not saying online sites/blogs ...
6
votes
3answers
3k views

Too Many Connections

I'm using MATLAB to feed the database but after a time I'm getting a too many connections error. I always using opendb and closedb in pair. Is it to fast the feeding? Do I have to wait after I ...
2
votes
2answers
124 views

Database Agnostic Conditional

I'm writing a Drupal module and I want it to be agnostic between PostgreSQL and MySQL. I have a field that gets its value from a conditional, and I originally wrote it as an IF(). Then I found out ...
1
vote
1answer
499 views

Concurrent INSERTs in XtraDB (InnoDB)

I'm currently unable to insert rows concurrently in an XtraDB table on Percona Server 5.1.54. I had the same problem with a similar version of MySQL. My table definition is as follows. CREATE TABLE ...
4
votes
1answer
2k views

Cannot drop anonymous user from mysql.user

I am trying to DROP the anonymous users from my mysql.users database. However, I have been getting odd behavior. When I enter the command: DROP User ''@'WOPR'; I was getting a generic error ...
0
votes
1answer
2k views

How to get query execution time and query result at the same time? [closed]

Is there any SQL query syntax that returns query execution time and query result at the same time?
7
votes
3answers
1k views

I am using the MEMORY storage engine but MySQL still writes to my disk…Why?

I am using the MEMORY Engine for all tables associated with a particular MYSQL query because speed of access is paramount to my project. For some reason, I have noticed that a large amount of disk ...
2
votes
1answer
321 views

MySQL Replication not working properly on Ubuntu Lucid Lynx Server

I have two Linux boxes. On the master following is the configuration file (my.cnf) log-bin = master-bin log-bin-index = master-bin.index binlog-do-db = test_db server-id = 1 master ...
7
votes
3answers
1k views

Can you “su -” in MySQL?

If I have root on a mysql database and I want to drop privileges to that of a normal user, without using their password, can I do it? if so how? think # su - username on unix. Basically, I'm just ...
4
votes
2answers
818 views

MySQL connection doesn't work anymore

I had two MySQL servers running (127.0.0.1:3306 and 127.0.0.1:3307). Now I get this strange error: mysql_connect(): Lost connection to MySQL server at 'reading initial communication packet' I can ...
5
votes
1answer
6k views

How do you increase MySQL performance using current server resources?

I have a MySQL database and some of my queries became slow. Query time is not stable. Most of the queries are fast, but some of them (may be that reads and returns less data) take long time. I know ...
3
votes
1answer
597 views

MySQL CREATE statement are really slow (Mac OS X / Macport install) [closed]

I recently noticed that recreating the database for the web application I am working on is taking a lot of time. I had just reinstalled Mysql from Macport... I am getting really lousy performances, ...
8
votes
3answers
3k views

Dynamic SQL in MySQL stored routines

According to the restrictions on stored routines and triggers, dynamic sql cannot be used (restriction lifted for stored procedures in version 5.0.13 and later). Why is this limitation in place? And ...
3
votes
2answers
356 views

TOP X of SQL Server in MySQL Analog

I am looking for SQL Server TOP (X) Analog in MySQL In SQL Server: SELECT TOP 5 Z ... FROM ORDER BY Z DESC How can this be done in MySQL? ADDED: I have found for other RDBMS: Returning TOP N ...
6
votes
3answers
2k views

Users complain that system runs slow when mysqldump is in progress.

The MYSQL database (ibdata1) is of size 73 GB and is configured to run as a dedicated database server on Windows 2008 O/S for INNODB tables. We are running the backup using mysqldump mysqldump ...
5
votes
1answer
321 views

MySQL and Solid State Disks on EMC

Since all writes and sequential reads are cached by the EMC storage system, the best use for solid state disk is to store data that has a random READ pattern. On Oracle, that is the temp tablespace ...
30
votes
2answers
7k views

NULL or NOT NULL by default?

In MySQL, is it better to always allow nulls unless you know a field is required, or always use Not Null unless you know a field will contain nulls? Or doesn't it matter? I know in some DBMSs they ...
7
votes
4answers
2k views

For a MySQL query, how do you determine physical and logical I/O?

I'm used to having a showplan in Microsoft SQL and have gotten lazy with using tools to tune MySQL queries. How can I determine physical/logical I/O for a query in MySQL? (EXPLAIN shows the index ...
3
votes
3answers
861 views

Database Performance Tuning

I have a MySQL backend, MS Aaccess front-end system that is nice and responsive over a local network but becomes sluggish over a broadband connection. I haven't done any performance tuning as of yet. ...
4
votes
5answers
1k views

What is the best use of memory in MySQL?

I have a MySql server with 2Gb of memory. What's the best configuration to use then with best results? How can I "distribute" this memory fine to MySql server?
4
votes
1answer
467 views

MySQL Replication: Insert generating VERY huge temporary tables

our replication slave is generating ~300GB temporary files while running relatively simple inserts. Our setup: Master: 5.0.45-0.sles10.x86_64, Slave: 5.0.85-win32, also tried with 5.1.57-win64, ...
6
votes
3answers
5k views

Avoiding temporary tables while sorting by a column in a different table

So I have this MySQL InnoDB query here: SELECT s.vid, s.body, s.timestamp, COUNT(v.id) AS votecnt FROM stories s LEFT JOIN votes v ON s.vid = v.vid WHERE s.lv = 1 AND s.status = 1 GROUP BY s.vid ...
2
votes
3answers
974 views

MySQL and PostgreSQL Licence issue

Our Company wants to use MySQL for one software product. This product is not open-source. Is it legal to use it freely ? If not, how about PostgreSQL ? Is this okay for our purpose ?
1
vote
3answers
122 views

Can I automate the “on” statement from MySQL queries?

Background In the process of QA/QC, I am writing lots of queries with multiple joins. I am using MySQL. I would like to know how (if) I can simplify join statements, e.g. by setting default fields ...
1
vote
2answers
1k views

Storing images in MySQL db — type? [duplicate]

Possible Duplicate: Is it better to store images in a blob or just the url? I need to recover images from an XML file stored on a remote server and save it to my database. Not sure how I ...
3
votes
2answers
2k views

Why is mysqldump file so large?

We have a 2GB MySQL DB. We started a mysql dump of this DB this morning and the resulting dump file is 27GB! Can anyone shed some light on what's going on here? Questions Why is this file so ...
2
votes
3answers
2k views

What are the best practices for triggers to maintain a revision number on records?

I have an audit trail implemented on an application database that captures old value, new value, modification time, and user inserting it into another table. I'm now wanting to add a revision number ...
2
votes
1answer
2k views

MySQL - LOAD DATA INFILE - Handling unescaped NULL in INFILE or creating INFILE with escaped NULL

I am selecting data from a database on server A, dumping the output into a file locally, and then doing a LOAD DATA INFILE on my local database. The bash command looks something like this: mysql -e ...
4
votes
2answers
1k views

Creating partitions on a production database

I have a production MySQL 5.1 database that is running well but I want to improve query performances. I have never used Partitions and just going through the manuals. I have two tables that involve a ...
5
votes
1answer
3k views

Are InnoDB Deadlocks exclusive to INSERT/UPDATE/DELETE?

I am Working around MySQL error "Deadlock found when trying to get lock; try restarting transaction". I am going to have to update a program to allow deadlocks. Is it possible that SELECT statement ...
4
votes
2answers
3k views

Determine Reason for Deadlock in MySQL

We've been seeing some deadlocks occur but have not been able to reproduce. Is there any way to determine, after the fact, what queries were running, etc to figure out why deadlock occurred?
2
votes
1answer
979 views

MySQL InnoDB data file directly on a disk slice (fixed-size)?

It seems that ibdata1 is like a disk slice. In Solaris (UNIX) UFS filesystems (the common one before ZFS), one would separate their disk c0t0d0 into slices, say a 10GB drive would be cut into three ...
2
votes
1answer
1k views

Installing MySQL server 4.1 on Ubuntu 11.04

how do I need to install mySQL server 4.1 on Ubuntu 11.04 server for a legacy app to run (it breaks on mySQL 5). sudo apt-get mysql-server-4.1 doesn't work - "package is missing, obsoleted or ...
3
votes
2answers
242 views

How can I model this relationship?

My database design skills are a bit rusty so I was hoping to get some help from y'all =) I have a 'user' table that contains all the typical fields (id,name,email,etc.). Users can have many ...