Questions tagged [mysql]

All versions of MySQL (not Microsoft SQL Server). Please also add a version-specific tag like mysql-5.7 if that is relevant to the question.

MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. MySQL is officially pronounced /maɪˌɛskjuːˈɛl/ ("My S-Q-L"), but is often pronounced /maɪˈsiːkwəl/ ("My Sequel"). It is named for My, the daughter of Michael Widenius (the original developer of MySQL)

The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL was originally owned and sponsored by a single for-profit firm, the Swedish company MySQL AB.

MySQL has changed ownership a few times over the years. Sun purchased MySQL in January 2008 for $1B. Some 15 months later, before the ink could fully dry, Oracle buys Sun. This made MySQL a subsidiary of Oracle Corporation.

Ever since Oracle has stepped into the picture, they have made good on their promises to make steady strides in MySQL development, which have come to fruition heretofore by means of better performance and configurability. However, older bugs still exist in MySQL. Oracle has not taken up the cause to fix these older bugs fast enough.

In light of this and in keeping with the spirit of open source liberty and freedom, forks of MySQL have propelled in the OpenSource DB World as viable alternatives:

These two are very active and highly regarded.

The two forks/trees/branches below must now be considered defunct.

MySQL can run on multiple platforms (32-bit and 64-bit)

  • Linux (Redhat Enterprise, Oracle Enterprise, Generic, Linux6 as for 5.5.17)
  • Sun Solaris
  • macOS
  • Free BSD
  • Microsoft Windows

MySQL features the use of several storage engines

Each Storage Engine has Distinct Properties that make efficient usage of data depending on

  1. Read Performance
  2. Write Performance
  3. Storage Requirements
  4. Memory Utilization
  5. Tuning the Engine Settings for
  • Internal Use
  • Multiple CPUs
  • OS Usage

For example, InnoDB has undergone a facelift which now allows it to take advantage of multiple CPU architectures. It was first introduced in MySQL 5.1.38 InnoDB Plugin. Those changes have now been fully incorporated in MySQL 5.5's InnoDB (Note: Percona Server already had these enhancements in 5.0 and 5.1. Oracle is nicely catching up). The necessary options have default settings that must be tuned to engage multicore activity.

Other third party storage engines have been used in MySQL including:

22387 questions
143
votes
11 answers

How to easily convert utf8 tables to utf8mb4 in MySQL 5.5

I have a database which now needs to support 4 byte characters (Chinese). Luckily I already have MySQL 5.5 in production. So I would just like to make all collations which are utf8_bin to utf8mb4_bin. I believe there is no performance loss/gain with…
geoaxis
  • 1,767
  • 2
  • 12
  • 11
52
votes
8 answers

Calculating disk space usage per MySQL DB

I am currently using information_schema.TABLES to calculate the total disk space usage grouped by the database name, but it is running terribly slowly. On servers with hundreds of databases, it can take minutes to calculate. What is the quickest…
GoldenNewby
  • 664
  • 1
  • 6
  • 8
50
votes
4 answers

How can I move a MySQL database to another drive?

I'm using MySQL 5.5 on a local machine to analyze a large amount of government data. I've created a local database that resides on my default drive (Win7 C: drive). I'd like to store the data on my E: drive, a large eSATA external drive. What steps…
user1243473
36
votes
2 answers

Is there a graceful or safe restart for mysql like for apache httpd?

I would like to restart mysql gracefully just like httpd where threads are served before restart. I would dislike queries breaking.
giorgio79
  • 1,407
  • 7
  • 19
  • 19
33
votes
12 answers

How to search whole MySQL database for a particular string

is it possible to search a whole database tables ( row and column) to find out a particular string. I am having a Database named A with about 35 tables,i need to search for the string named "hello" and i dont know on which table this string is…
Kevin Parker
  • 431
  • 1
  • 4
  • 5
28
votes
1 answer

Easiest way to duplicate rows

The closest I can find to what I want to do is How to duplicate related rows, but my inexperience gets me lost. Basically, I want to copy a number of records, change one column and insert them back into the same table (so its almost a duplicate of…
fiprojects
  • 425
  • 1
  • 4
  • 9
26
votes
2 answers

Get a fixed value on a select

I need to do a SELECT query where I get the value of the field "money". The field doesn't actually exist in the database. I just need the query to return this field with a fixed value; in this case a value in USD. How do I return a constant value…
fedejp
  • 263
  • 1
  • 3
  • 4
26
votes
1 answer

Is there any difference between 'LIMIT 0, 1' and 'LIMIT 1'?

I recently stumbled upon example codes, which differed by these notations. SELECT * FROM table LIMIT 0, 1 SELECT * FROM table LIMIT 1 The first argument should be considered as the offset if I'm not wrong, the purpose of those two queries is to…
Gimu
  • 363
  • 1
  • 3
  • 5
24
votes
3 answers

What's the minimum privilege needed to alter a foreign key constraint?

What's the minimum privilege needed to alter a foreign key constraint? My migration script stopped working after MySQL 5.5.41 fixed this bug: InnoDB permitted a foreign key to be created which referenced a parent table for which the user did not…
mtmacdonald
  • 421
  • 2
  • 4
  • 6
23
votes
7 answers

MySQL - How to check for a value in all columns

I am curious, is there a good way to search all columns for a given value? For my purposes, it doesn't need to be at all fast, it's just a 1-off kinda thing, and I don't really want to have to type out every field name. That's precisely what I'll be…
donutguy640
  • 449
  • 1
  • 4
  • 11
22
votes
4 answers

MySQL - Alter table to automatically put in a UUID

Ok, I know I've done this before. But I cannot for the life of me figure it out. I created a table. One of the columns is labled "LogID", it is also the primary key. How do I alter it so that this column generates a UUID for each new entry?…
Matt Winer
  • 395
  • 1
  • 3
  • 7
21
votes
2 answers

How to determine MySQL queries per day?

I'm investigating the big switch from MySQL to a NoSQL DBaaS and I've run into an issue trying to forecast expenses. Essentially, I can't figure out how many queries my current MySQL server handles per day to try and estimate the number of requests…
AJB
  • 385
  • 1
  • 3
  • 8
21
votes
1 answer

Struggling to debug high CPU usage on Amazon RDS MySQL instance

We're running an m1.xlarge MySQL RDS server and having some issues with high CPU usage. We had some problems a couple of weeks ago with CPU utilization reaching 100% on a large instance. When we upgraded the size to xlarge that stabilised things for…
WillJThomas
  • 471
  • 1
  • 3
  • 7
20
votes
2 answers

Does MySQL cache queries?

I'm interfacing a MySQL database with PHP Data Objects (PDO) and executing an extensive SQL query. Normally, it takes about 1500 ms; I still need to optimize it. When I run the PHP script twice with a short interval in between, the query only takes…
user24821
19
votes
7 answers

How to show the column names of a table?

The case is simple: You have a MySQL database where you have only an SQL query interface and you want to know the database structure with queries. You can list tables with show tables; command, but how do you see the individual column names? (SELECT…
mico
  • 511
  • 3
  • 7
  • 19
1
2 3
99 100