MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

0
votes
1answer
567 views

How to avoid table crash?

Couple of days back I had a table with 7GB of data and it was showing 63MB of overhead in phpMyAdmin and I mistakenly started its optimization and after working of more than 40 mins it corrupted the ...
3
votes
3answers
2k views

When do hash indexes become reasonable?

MySQL natively doesn't support hash indexes. So, making a pseudo hash column and creating an index on a hash column needs some thinking. And it seems to be widely understood that if the text field is ...
1
vote
1answer
384 views

Simple select statement not returning correct data

I am trying to return data, where I want the item name (items.name), vendor name (vendors.name), url of the price (prices.url), and the price (prices.price) from 3 different tables (items,vendors and ...
3
votes
1answer
9k views

Equivalent functions in MySQL that exist in SQL Server

In an EXIT HANDLER block, what are the MySQL equivalents of OBJECT_SCHEMA_NAME(@@PROCID) + '.' + OBJECT_NAME(@@PROCID) ERROR_MESSAGE() Edit What I want to do. In SQL Server I'd have CREATE PROC ...
1
vote
2answers
714 views

What is com_set_option?

As the title says, I'm wondering what is this command and why am I seeing a large amount of this query on my database? It's currently 13.30% of my total queries. I've tried googling this but there's ...
1
vote
2answers
305 views

Adding a new slave slowing down previous replicas?

I have a master I was going to start slaving to a new server to do some tests on. This master is currently being slaved to 3 other boxes. After bringing the new slave online it became clear it ...
1
vote
3answers
2k views

MySQL: Trying to update to 5.5

I've followed this instructions, but after mysqld --skip-grant-tables --user=mysql, I'm getting this: 110913 20:29:18 [Warning] Can't create test file /var/lib/mysql/my-laptop.lower-test 110913 ...
4
votes
1answer
1k views

Determining max database and table size supported and present size

One of my MySQL databases has been running on a single PC from the last four years. Here is my setup: MySQL 5.5.14 Windows XP on NTFS partition All of my tables are using InnoDB engine Here are ...
6
votes
3answers
680 views

Is there a need to keep refreshing the indexes from time-to-time?

This question is common for all the database products I use, viz. SQL Server, MySQL, Oracle and PostgreSQL. I have created a fresh database and the tables, at present, have no records. I have created ...
3
votes
1answer
1k views

How do you gain access to embedded MySQL database via localhost command line?

We run an application (Windows 2003 server) and would like to have database connectivity -- contacted the company and they do not have any documentation on how to do so. A quick glance at the ...
47
votes
4answers
76k views

Possible to make MySQL use more than one core?

I've been presented with some dedicated MySQL servers that never use more than a single core. I'm more developer then DBA for MySQL so need some help Setup The servers are quite hefty with an ...
6
votes
2answers
5k views

MySQL Auto_increment going 2 by 2

I installed MySQL Workbench the other day, accessed my company's database and made myself a table to work with. So far so good. The problem is, I noticed my auto_increment is incrementing 2 by 2. For ...
4
votes
2answers
6k views

Internal reason for killing process taking up long time in mysql

I copied a big table's structure with (it is an InnoDB table btw) CREATE TABLE tempTbl LIKE realTbl Then I changed an index, and filled it up so I could run some test. Filling it was done using: ...
2
votes
2answers
364 views

Database Transfer from PostgreSQL to MySQL

Is there any method to tranfer the data and schema from a postgresql database to mysql?
6
votes
2answers
4k views

Is this a normal set of MySQL privileges?

Using phpmyadmin on a local test wamp setup, and well as pretty much the title states, there are 3 users marked as user = ANY, password = NO, such as: USER | HOST | Password | Global Priv | Grant ...
3
votes
1answer
522 views

InnoDB has a transaction running, but “SHOW PROCESSLIST;” shows nothing

I have a replicated database setup, mostly Innodb databases/tables. The query that I believe caused the issue ran in about 20 minutes on the master database. This is where it gets weird. Show ...
6
votes
2answers
2k views

Does a view need its own foreign key constraints?

Disclaimer: I'm a programmer, not a DBA, so bear with me... I have a view that I use to just map 2 entities together. I have to do a join between a few different tables to get that: CREATE OR ...
5
votes
4answers
1k views

Does putting single quotation marks around numeric constants really protect from SQL injection in MySQL?

The manual seems to suggest that using quotes around numbers is sufficient to protect from SQL injection. According to section 5.3.1. General Security Guidelines of the MySQL 5.1 Reference Manual: ...
3
votes
1answer
4k views

Rebooting a MySQL Replication Slave

For the first time since it was set up I need to reboot a read-only MySQL replication slave. I found this article about downing a slave for maintenance (albeit he's just describing stopping the mysql ...
0
votes
1answer
158 views

Add parent_id dynamically based on another field

I have a version table using a field to track order: id, owner_id, order, version 5, 1, 1, 1.1 6, 1, 4, 1.2 7, 1, 7, 1.2.1 8, 1, 10, 1.3 I want to ALTER TABLE version ADD COLUMN parent_id and have ...
3
votes
4answers
4k views

How to find dependencies on a table in mysql 5.0?

I am trying to drop a table in MySQL but its complaining about "Cannot delete or update a parent row: a foreign key constraint fails"... Questions Is there a way to find out all the table ...
5
votes
2answers
5k views

MySQL, foreign key, can't create table error 150

UPDATE: Sorry, it was because i forgot to add UNSIGNED attribute to the lang_id column. Original: I'm trying to create a table with foreign key in MySQL. I get this error: #1005 - Can't create table ...
1
vote
1answer
565 views

MySQL CPU Usage

To remove duplicate rows in a table I did the following (about 200k rows) table1: id_a int id_b int val_a int val_b int pk (id_a, id_b), index id_a, index id_b Algorithm: created table2 as select ...
3
votes
4answers
4k views

MySQL : Conditional ORDER BY to only one column

Hello and thanks for taking time to read this question. I am using MySQL, and I want to sort results using ORDER BY to one specific column, but the results must be ordered according an specific ...
2
votes
2answers
3k views

Corrupt InnoDB tables after every mysql restart. What's wrong?

Recently I changed a few settings in my mysql configuration. I did the following: - stop mysql - save the changed settings - delete all ibdata and ib_logfiles - start mysql Normally this works fine ...
2
votes
2answers
2k views

Insert Into MySQL over linked server when a medium text is the last column breaks Int fields

I have a table with ID INT(16) StateName VARCHAR(50) Details MEDIUMTEXT When I do an insert over the linked server connection: Insert Into MySQL...tblState (ID, StateName, Details) Values ...
2
votes
2answers
2k views

How to set addtime(current_timestamp, '15:00:00') as MySQL timestamp column default value?

I want to set `addtime(current_timestamp, '15:00:00') as the default value of one MySQL table column. I tried to do this with the following command but failed: mysql> alter table mytable change c1 ...
2
votes
2answers
4k views

MySQL : Is there a command similar to FLUSH STATUS to reset GLOBAL STATUS?

I'm trying to run some load tests on my MySQL server and check a bunch of relevant GLOBAL STATUS variables after each run. Is there an easy way to flush GLOBAL STATUS variables like the regular FLUSH ...
12
votes
5answers
26k views

MySQL server has gone away obstructing import of large dumps

I am trying to import a large sql dump (2GB) to my local mysql on my mac. I have been able to do this in the past (I was using MAMP), but now I get a ERROR 2006 (HY000) at line 7758: MySQL server ...
2
votes
1answer
662 views

What are the pro's and con's of using PostgreSQL vs MySQL for binary data?

I read that MySQL has binary safe blobs, but PostgreSQL does not. So far what I've found suggests that "binary safe" is something that really relates to functions and handling of data, not the data ...
1
vote
2answers
281 views

MySQL for Administrators course from Oracle: worth it?

This is a question probably experienced MySQL admins can answer, but is not really a technology question. I am looking into MySQL Administraton course from Oracle/MySQL AB. It seems interesting as ...
10
votes
2answers
16k views

What is the reason of Host 'host_name' is blocked in MySQL?

When I use incorrect password to connect to mysql server, and the test count is over the max_connect_errors, and I find the Aborted_connects is also arise as the count I test, but the host is still ...
11
votes
3answers
15k views

MySQL table_cache and Opened_tables

I have seen people use the comparison of Open_tables and Opened_tables to assess whether the table_cache is too small in MySQL. However, I believe that Opened_tables is cumulative across uptime, so ...
1
vote
1answer
208 views

MySQL duplicate data entry issue

I know this issue can be solved using unique key constraint on column and some insert command variation. But I exactly want to know that at last why the following approach goes wrong sometimes and a ...
1
vote
1answer
585 views

Applying MySQL 5.1 bin log to MySQL 5.5

Is it possible to apply MySQL 5.1 bin log to MySQL 5.5. I am assuming that bin log is portable between two machines (same OS, Architechture but different machines running same version of MySQL)
4
votes
2answers
2k views

Preordering the table by a specified column

I have a table and I am always getting the data by ordering a column. In my case, I order by datenum. However, the selection is so slow because of the ordering. Is it possible to order the table ...
5
votes
1answer
1k views

MySQL Replication : 1 Slave / Multiple Masters

I have a web app with 2 web servers and 2 database servers. The DBs are setup for multimaster replication. (this is the primary environment) I also have the exact same setup on a different location ...
5
votes
6answers
540 views

Check if DISTINCT is really necessary

I have a query in mysql as follows. SELECT DISTINCT `tableA`.`ColA`, `tableA`.`ColB`, `tableB`.`ColA`, ... FROM `tableA` LEFT JOIN `tableB` ON `tableA`.`colC` = `tableB`.`colA` WHERE ...
14
votes
2answers
3k views

Rows missing after online conversion from MyISAM to InnoDB

We have a reasonably small database that we wanted to convert from MyISAM to InnoDB. Being database noobs, we just converted (using alter table) without even taking the site down. Now that the ...
2
votes
1answer
853 views

MySQL Master/Slave Master/Master setup?

I currently have 1 mysql server running and want to install 2 seperate mysql VPS'es. Maybe one master for inserts/updates and one slave for selects. What is the best setup for this if I have the ...
9
votes
1answer
5k views

Is there such thing as Custom Data Types?

Does MySQL have any support for custom data types? For example, zip codes might be stored in a varchar(10) field, but they could be compacted in to an int, with options for blank, and a flag as to ...
2
votes
2answers
3k views

Indexing for group by + SUM query on mysql

I have a table with the following schema: CREATE TABLE `wordtrend` ( `oid` bigint(20) NOT NULL AUTO_INCREMENT, `monitorId` bigint(20) DEFAULT NULL, `nGram` varchar(255) COLLATE ...
3
votes
3answers
4k views

Want to order on two columns but not the usual way

I have a table as below ID userID Date 1 2273 22/08/2011 2 2274 24/08/2011 3 2275 26/08/2011 4 2273 26/08/2011 5 2273 26/08/2011 6 2271 26/08/2011 And want result as ...
3
votes
5answers
2k views

MySQL slow query log: huge query time, no lock time, minuscule number of rows scanned

I have a slow query log item with the following: Query_time: 55 Lock_time: 0 Rows_sent: 739 Rows_examined: 739 No one in my group can explain it besides a guess about packet loss. Is there a ...
7
votes
1answer
8k views

mysqldump with INSERT … ON DUPLICATE

I want to merge data from one database to another. So I create dump with mysqldump and then import it to another database (with same tables structure). I don't have any problems (such as duplicate ...
3
votes
1answer
9k views

How do you tell which host is close to being blocked in MySQL?

I've a two part question: 1.In cases were this error comes up: PDOException: SQLSTATE[HY000] [1129] Host `hostname` is blocked because of many connection errors; unblock with `mysqladmin ...
4
votes
1answer
2k views

MySQL 'LOAD DATA INFILE' : Can't replace entry when foreign key exists

Here's a minimal case for my database scheme: CREATE TABLE `test` ( `id` int(11) NOT NULL, `name` varchar(22) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT ...
3
votes
3answers
147 views

Is there any way to temporarily enforce columnar uniqueness on items currently being inserted?

Is there any way to temporarily enforce columnar uniqueness on items currently being inserted? For instance, I'm splitting payments and charges to their own tables from a previously unified ...
5
votes
1answer
472 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 ...
2
votes
3answers
7k views

Clear all tables with one DELETE

Is it possible to clear all tables with one request? I have tried the following with no result. DELETE a,b,c,d,e,f,g,h,i,j,k,l,m,n,o FROM jos_bet_details as a, jos_bet_1x2 as b, jos_bet_1x2_best as ...