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.

learn more… | top users | synonyms

1
vote
1answer
188 views

MySQL, can't find MYD files on OS X, MAMP

Try as I may I can't find the data files for my MAMP installation! FRM files are here: /Applications/MAMP/db/mysql/database_name/ but, there are no corresponding MYD or MYI files anywhere. The ...
1
vote
1answer
175 views

In slow_log tables, sql_text column showing “throttle: index not used' warning(s) suppressed” instead of exact query

I'm trying to find the slow running queries from slow_log table (as I don't have direct access to server to check slow log file). In sql_text column instead of query it is showing "throttle: index not ...
0
votes
1answer
45 views

What is a good size to accommodate a single-use database for a small application? [closed]

I'm looking to provision out arbitrarily many sandboxed MySQL databases for anyone to use, similar to how SQLFiddle does, but permanent and with API keys (one database per key), which would allow ...
1
vote
1answer
1k views

Correct 'lines terminated by' for query

I am trying to query two tables of data and send them to a csv file for upload to a website. However i am having trouble getting the formatting to play ball. I want headings to separate into columns ...
1
vote
0answers
2k views

SQL Error 1452 : Cannot add or update a child row: a foreign key constraint fails

I am trying to install Zabbix by following this guide. I ran into the following problems when trying to run data.sql after running scheme.sql successfully mysql -D zabbix -uzabbix -pPassword < /...
0
votes
0answers
42 views

Most efficient way to store a large, changing number of properties

I have an entity with a large number of boolean properties. It currently has ~100 properties It will periodically get new properties The number of properties will grow to 400+ There will be ~200,...
1
vote
1answer
124 views

best design for my data storage

I am looking for advice on storing rows of data. What I have a bunch of users (id), and data about their activities. Each user can perform a type of activity (type_id). And then about 20 columns ...
0
votes
1answer
571 views

Shell script for backup binlog files for every 8 hours in MySQL

I'm writing a shell script for point in time recovery for MySQL Instance. Our requirement is backing up Binlog for every 8 Hours (Daily 3 times) using mysqlbinlog and it should backup binlog starting ...
0
votes
1answer
296 views

'USE db_name' takes too long to change when login remotely

I gave SELECT privilege to a user on a particular database, Now whenever I try to connect remotely $ mysql -h ip-of-remote -u username -p with that user credentials and try to change the database ...
0
votes
1answer
126 views

Update Column in table on midnight daily

I am designing a simple 1 table database in mySQL that will have two columns. One column will be the name of a specific restaurant on the webpage I will be using this database with. The second column ...
1
vote
2answers
145 views

Awful execution plans after migrating from MySQL 5.5.11 to MariaDB 5.5.41

We just migrated our web site database from a server running MySQL 5.5.11 to one running MariaDB 5.5.41. Everything is working mostly fine, except there's at least one query from our storefront that's ...
0
votes
1answer
647 views

How do I perform a query on a dynamic list of tables?

I have a database named as ( conntrack ) with unknown amount of tables.I have a static table "tabidx" which has one column "date". The following table is static and its name is tabidx which provide ...
0
votes
2answers
88 views

Get a user's rank from an equation, and then store it in the table

I'm working on a project for my database class, and I have a table called "accounts". It looks like What I want to do is have a stored procedure where it calculates the new ranks for each account. ...
0
votes
2answers
655 views

MySQL - best practices/ how to speed up "update, else insert' queries? Insert + delete faster?

I'm running an ETL process and streaming data into a MySQL table. Now it is being written over a web connection (fairly fast one) -- so that can be a bottleneck. Anyway, it's a basic insert/ update ...
0
votes
1answer
79 views

Can anyone explain TokuDBs seemingly large amount of data_free for an append only table?

I have a large table I've been maintaining replicating in parallel in innodb in one slave and tokudb in another. I'm seeing promising results in expected compression ratios but am noticing something ...
0
votes
0answers
79 views

Best way to restore 400GB+ worth of data in MySQL 5.6

So I'm trying to figure what the best/quickest way would be to refresh a massive amount of data. We're wanting to copy 3 months worth of data from a replication server to a QA server for product ...
3
votes
3answers
486 views

How to generate documentation from stored procedures? [closed]

I'm working with a new set of tables and an increasing list of stored procedures. Is there a way to generate documentation out of the comments on tables and stored procedures, like autodoc or doxygen?...
-1
votes
1answer
2k views

SQL Error 1054 Unknown column in 'where clause' [closed]

I've created an database with 5 tables and each of the tables have various rows and columns as data. When I try to select some of that data, I'm getting that error in the title and I have no idea how ...
1
vote
1answer
28 views

Updating databases that user's can manipulate

I have a product that includes a MySQL database with some defined countries (very few, not all of them). The user has some control over this table - they can add / edit / delete countries. When we ...
6
votes
8answers
9k views

How to find the nth highest salary in SQL?

I have found a query to find the nth highest salary from Employee table , but i don't understand the logic of (N-1)? EmpID Salary 1 90000 2 80000 3 54000 4 ...
0
votes
1answer
39 views

Does having no brackets at “WHERE” produce same results as having brackets? [closed]

Does having no brackets at "WHERE" produce same results as having brackets? I have same result, just wanted to confirm, because from my memory it always best to use rounded brackets. SELECT `document`...
0
votes
1answer
51 views

How to determine if an Index is uselss in Percona MySQL?

Using Percona Server 5.5 I've a table which stores user activty (lets call it user_activity). It was created quite a few years ago when I had only a little bit of knowledge about database ...
4
votes
3answers
3k views

Select Column value based on two values in another column [closed]

I am using the below table: 1 0051ML66220600132482 06:00:00 06:00:00 1538 100 0 1 2 0051ML66220600132482 06:00:00 06:00:00 1540 200 0 0 3 ...
3
votes
2answers
116 views

Mysql Index for concat select

For Below Query SELECT MAX(CONCAT(date, ' ', last_entry)) AS LAST_LOG FROM entry_log WHERE TRIM(LEADING 0 FROM card_no)='2948' I've index on date card_no date,last_entry date,last_entry,...
1
vote
1answer
50 views

Sync Data Without Replication

I have a database server I am using an old dump from to restore due to the need of older records that must be brought back. I also need to sync to this database the new entries from the current ...
0
votes
1answer
97 views

Query databases that have MYISAM tables that do not have only fulltext index tables

I am trying to query from the information_schema where the database (table_schema) has MYISAM tables but does not have only fulltext index tables. The statistics tables is very poorly designed for ...
0
votes
0answers
59 views

Insanely slow replication after MHA promotion

I have a replication setup with 1 master and 3 slaves. I promoted the current master to one of the slaves using MHA. That went seemingly flawless, not errors reported, everything marked ok. Spot ...
1
vote
2answers
438 views

Normalization of library book table with multiple authors

I have a database structure with two tables: The first one is called Author, has two columns (AuthID, AuthName) and its Primary Key is (PK_AuthID). The second one is called Book and has three ...
0
votes
1answer
350 views

set session wait_timeout inside of phpmyadmin for export/import

I need to increase wait_timeout variable in mysql only when access mysql from phpmyadmin. I don't want to edit my.cnf file or set it globaly in mysql server. I've read documentation, but haven't ...
1
vote
2answers
163 views

How to join tables when one of them doesn't have any relationship with the others

First of all, I know what I am about to show you is a completely DB mess but I just got it like this. Tables : Authors manufacturers_id manufacturers_name 1 Name1 2 ...
0
votes
2answers
262 views

How to create function using another functions mysql

I want to create a function in MySQL using another function but I am getting an error "Explicit or implicit commit is not allowed in stored function or trigger". This is my code: DELIMITER $$ ...
5
votes
2answers
29k views

If exists then update else insert

I am trying to create a STORED PROCEDURE that will be used to UPDATE a table called machine. This table has three columns (machine_id, machine_name and reg_id). In aforementioned table,reg_id (INT) ...
1
vote
2answers
74 views

professional services (consultants) resource allocation system

I am developing a resource allocation system using PHP and mysql. I have consultants and projects and I need to allocate the consultants on to various projects for various periods of time on various ...
2
votes
2answers
87 views

What are some known hazards with cyclical replication between two MySQL master servers?

If I were to set up cyclical replication between a MySQL 5.6 master server and a MySQL 5.1 master server, what are some things that could potentially go wrong? Also, the 5.6 MySQL does not have GTID ...
3
votes
1answer
1k views

Rich text: VARCHAR, TEXT or BLOB in MySQL

Question: In my web application (php/MySQL) I will be saving rich text. This may be anything from a couple words to several pages length essay. I’m sure I could get away with using VARCHAR, TEXT or ...
1
vote
0answers
357 views

Using SESSION sql_mode = 'NO_BACKSLASH_ESCAPES' before running query to remove backslashes in database

See this post: How do I remove backslashes from records in MySQL I have similar issues in that code that was developed before me did not use strip slashes with magic_quotes_gpc on before inserting ...
1
vote
0answers
50 views

A design pattern for category features [closed]

I work for a system which has these tables: products , categories , features User wants to add some feature like color dynamically. Which of this following ways are true? First one: Product ...
1
vote
1answer
830 views

How to remove leading zero from date [closed]

I have a query in which i have used the following date_add(DATE_FORMAT(ss.week_startdate,'%y-%m-%d'),INTERVAL (tt.day_id- 1 )DAY) as date Datatype of the field is datetime and the result date is ...
5
votes
1answer
111 views

How does mydumper's ''--use-savepoints" option reduce metadata locking

MyDumper 0.6.1 add a new option --use-savepoints. From the manual, it means: Use savepoints to reduce metadata locking issues, needs SUPER privilege I don't understand. How does it "reduce ...
1
vote
1answer
49 views

MySQL GTID replication: is it possible to make DDL changes to a slave and then catch it up to a master?

Here's what I would like to do: 1. hang a slave off my production master. 2. stop replication 3. adjust some data types and create some indexes on the slave (no data mods) 4. restart replication 5. ...
1
vote
2answers
457 views

MySQL on Ubuntu consuming almost all RAM

I've been having an issue with MySQL crashing randomly, apparently as a result of not having enough available memory (as discussed here: https://www.digitalocean.com/community/questions/mysql-on-...
1
vote
1answer
100 views

Insert/ Update Scalability (more records, continually longer lookups — solution?)

posted this before but never received a clear answer. I'm working on an ETL project and am basically feeding JSON records of "tickets" into a MySQL database. (actually come to think of it, may be ...
2
votes
3answers
472 views

Query 'optimizing' state is taking too long

I have a MySQL 5.6 on Amazon RDS that I'm using for testing some data archiving scripts. I'm removing oldest data based on a "updated_date" column and index. Curiously, after removing a few million ...
2
votes
2answers
192 views

Does MySQL support querying for the current running transaction id

PostgreSQL supports retrieving the current running transaction id using a query like this: select txid_current(); Does MySQL have any such equivalent?
1
vote
2answers
3k views

grant select on all databases except one mysql

I have user called test_user created under MySQL 5.5.17 under MS Windows 2008R2, I want to grant this user select privileges on all databases except MySQL database, note I have around 200 database ...
0
votes
0answers
237 views

SQL Server to MySQL data transfer using Talend Open Studio - recent performance drop

I have a problem with data transfer speed from SQL Server to MySQL server using Talend Open Studio. Normally my job has been able to transfer about 5000 rows/sec-7000 rows/sec. But lately the job ...
0
votes
3answers
123 views

Schema Design with “Seasonal” Data

I am developing a SaaS web application for School Management. What I need help is this: The whole application is purposed for the current year that the School is in. However, some data and ...
1
vote
1answer
86 views

Duplicate delete query in binary log of MySql Master

We are facing strange problem, while replication data from master to slave. Same data is being deleted twice in log(How ever only one row is deleted and one time),due to which we are getting error ...
1
vote
1answer
166 views

Write-lock a whole table during transaction

I need to perform a delicate operation to my table in which I will solely insert, delete and select upon all of my rows and no God may interfere with the table during this operation: the table will be ...
1
vote
1answer
34 views

Search functionality using joins

I have three tables as mentioned below. I need to implement basic search functionality where the user will search for a keyword which could either match 'title' (from Proposal table) or 'msNumber' or '...