MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

0
votes
0answers
10 views

Logic value of assginment expressition

I'm doing the leetcode SQL problems and kind of confused with the code below: select distinct Num from ( select Num, case when @prevNum = Num then @count := @count + 1 ...
0
votes
0answers
14 views

How to accept apostrophe in a form field for MySQL

I have a form that accepts a few names and phone numbers and posts them to a PHP script which then inserts those values into a MySQL table. The code (PHP) is pretty straightforward as you can see ...
2
votes
1answer
10 views

How do I change the config path for mysqld?

I want to change configuration file path from C:\ to E:\, but I can't find the way to do this. Alternatively, is there a way to start a new instance with the config file I want? I've done something ...
0
votes
0answers
15 views

Group by maximum consecutive row

I have data like the following id | src_ip | dst_ip | port | ----|----------------|--------------|------| 256 | 192.168.61.200 | 10.75.64.222 | 80 | 257 | 192.168.61.200 | ...
0
votes
0answers
5 views

MySQL Queries in UDF

I would like to create a MySQL UDF (i.e. User Defined Function) that embeds a query; for instance, suppose the UDF is named foobar: mysql> SELECT foobar(); When foobar function receives the ...
0
votes
0answers
8 views

MySQL/InnoDB - Clustering Index with UUID

In MS SQL Server it is possible to cluster an index on a non-primary, non-unique key. For example, if I wanted to create a clustered index on the insert date to prevent page splits and fragmentation ...
2
votes
1answer
17 views

Mysql slow slave

Background: We have our main databases at a data centre which are all working fine. I wanted to add a slave server at our office for backup purposes. I have copied all of the data from an existing ...
2
votes
1answer
16 views

Too many mysql instances. How to kill?

I should be ashamed of myself, for asking, I know. Check out this screenshot attached. My server, which is indeed not seeing HUGE amounts of traffic, should not be this overloaded. Mysql is having ...
0
votes
0answers
11 views

How to tell when a stored procedure is scheduled in MySQL

We have a stored proc that runs daily but I'm trying to figure out when and how it runs. There's nothing scheduled in cron and when I do a show events nothing comes up. I even checked select * from ...
1
vote
2answers
20 views

Mysql causing high load average with large amount of server resources left

I've have 2 servers running a application and the server that runs the mysql sgbd is with the load average around 3 times more than the webserver. I think that is something wrong because i have a lot ...
1
vote
2answers
62 views

SELECT and UPDATE in a single query while updating selective fields of duplicate records only

I have a MySQL table named Contacts_table with, say, the following contents: ID NUMBER NAME CITY 001 2222222222 John Doe Los Angeles 002 ...
1
vote
1answer
24 views

How do you grant permissions to a MySQL user using a shell script with variables?

I'm trying to create a provisioning script for Scotch Box (Vagrant) that will populate a database with seed content when I fire up the server. When I name the actual user, database, password, and ...
1
vote
1answer
14 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
17 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
0answers
7 views

table with reference to 2 other tables for ORM [migrated]

I need to have a comment table which references 2 other tables, posts, and article. 3 in total including the user_id. Comment ------- comment_id user_id article_id post_id Is this possible? I ...
0
votes
1answer
31 views

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

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
23 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 ...
0
votes
0answers
16 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
10 views

Update MySQL column from column in another table

I have a table, products2013, with column upload_id which I would to contain the value upload_new_name from correlating table uploads (also containing upload_id). I tried putting together the follow ...
0
votes
0answers
21 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 ...
1
vote
1answer
62 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
0answers
6 views

MySQL - Update vs. Replace Into — why is Update non-parallel, and Replace Into allows multi-threads?

In trying to optimize a query that does (Insert ... on duplicate key update) .... someone suggested I do "Replace Into" to optimize performance. I'm not 100% certain the difference other than ... ...
0
votes
1answer
20 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
26 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
10 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
20 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
38 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
26 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
0answers
26 views

How to avoid data fragmentation in a MySQL table

We have a table in MySQL that contains several years worth of hourly time series data. A few thousand rows get added to the table every day. We're using the InnoDB storage engine. At this point we'd ...
0
votes
2answers
30 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
0answers
11 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
38 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
45 views

How to generate documentation from stored procedures? [on hold]

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 ...
-1
votes
1answer
20 views

SQL Error 1054 Unknown column in 'where clause' [on hold]

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
19 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 ...
4
votes
6answers
1k 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
18 views

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

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 ...
0
votes
0answers
13 views

Memory consumption of production MySQL

The MySQL database on one of my production servers consumes a lot of memory. The problem is that I cannot trace what causes that kind of high memory usage. Following values illustrate the problem. ...
0
votes
1answer
35 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 ...
2
votes
1answer
34 views

Select Column value based on two values in another column

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
54 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 ...
0
votes
1answer
26 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
19 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
16 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
61 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
30 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 ...
0
votes
2answers
83 views

How to this query? [on hold]

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
28 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 $$ ...
1
vote
1answer
141 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
23 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 ...