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

0
votes
0answers
5 views

PDO does not fetch any results

I was using PDO queries directly in index.php file.Now I want to create separate file where I will store functions. I created one, but when I call function returns only "0". Old version works: ...
1
vote
2answers
54 views

MAX of a varchar column

I have a table with a column named price typed as varchar. I want the maximum value of this column. I am using this query: SELECT MAX(price) FROM product_management.`item_list` but the result is ...
0
votes
1answer
22 views

Speed benefits of Mysql Multiple Delete/Insert vs Select

I am working on a web application which involves a regular API call to the Amazon Product Advertising API. Given that Amazon limit the calls to one per second, I am looking at the fastest ways to ...
0
votes
1answer
25 views

mysql selecting a distinct summed column while having

I have a one-to-many relationship between two tables, where I need to get distinct values out of a summed column b while limited by another summed field a SELECT t1.a - sum(t2.a) as a, t1.b - ...
0
votes
1answer
31 views

mysql CREATE TRIGGER after insert on Update column with count

it gives error. I don't understand why. CREATE TRIGGER `estatecat_piece` AFTER INSERT ON `estate` FOR EACH ROW BEGIN UPDATE estate_category set piece = (Select count(*) from estate where ...
0
votes
1answer
27 views

Is the syntax of Oracle 10g and MySQL the same?

Is the syntax of Oracle10g and mysql are the same? For example the select query? Thanks, I'm using MySQL and want to try Oracle 10g for my java.
1
vote
1answer
37 views

Select Units Sold and Total Units Sold from a Sales record table

I am trying to Select Units Sold and Total Units Sold from a Sales record table using. When I use this Query, I can get the Units Sold for '2016-04-14' SELECT salesrecord.itemID, ...
1
vote
2answers
33 views

InnoDB file per tablespace

I am using following syntax to create an InnoDB table: create table InnoDB_Test(a INT) DATA DIRECTORY='/var/log/storage/MySQL' INDEX DIRECTORY='/var/log/storage/MySQL' engine=InnoDB;` I want to ...
0
votes
1answer
23 views

Check is there is an Empty Column Value

Let's say we have a Table in MySQL Database called TAB1 that Contains two Columns col1 : col2 . the question is : is there a way to check is any of these Columns Contain a Null or Empty Value? for the ...
0
votes
0answers
12 views

Amazon Aurora Replication Error

I'm creating a replication between two Amazon Aurora Cluster following this: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Replication.html#Aurora.Replication.MySQLReplication.Monitor ...
0
votes
0answers
21 views

Is that hybrid model i thought with Mongo and MySQL fits?

I'm building a System with Node.js-Express.js and at first i decided to use MongoDB to store. But a moment ago i read that article and it made me think about it. Article talks about a MongoDB exp. ...
1
vote
0answers
16 views

Find entire hierarchy based in all hierarchy levels [duplicate]

I have a table that looks like this: Where EMP has a child SEG and it has a children SUP and so on... What I would like to do is find the full hierarchy EMP>SEG>SUP>DIR>REG>GOP in any of the ...
1
vote
0answers
30 views

Percona 5.7 tokudb poor query performance - wrong (non-clustered) index chosen

I have a table with about 8.5m rows in it. The table is tokudb and it has the indexes described below. I'm experiencing dismal performance when trying to run update statements like the following: ...
2
votes
2answers
65 views

Filtering a result set on a very large table (using INCLUDE index in SQL Server)

Consider a very large table having hundreds of millions of rows defined as -- Here ObjectIdName and ObjectTypeName together are unique. -- Due to their size they aren't indexed, but rather they are ...
2
votes
1answer
25 views

How do you properly remove “REQUIRE SSL” from a single user?

I successfully granted REQUIRE SSL to a single user by doing... mysql -u"${targetMySqlUser}" -p"${targetMySqlPass}" -e "GRANT USAGE ON dbname.* TO 'dbusername'@'%' REQUIRE SSL;" but im failing on ...
0
votes
1answer
22 views

Galera Cluster not syncing from a standalone Mysql Server

I had setup a 3 node Galera cluster in production network. And I am replicating the data from a Standalone MySQL Server to one of the galera node(node1) through master slave replication. I can ...
0
votes
0answers
49 views

Very Very Veeery slow insert queries

I am writing here because I`ve already spent days reading tutorials, other topics in here, and trying different configurations. The project : Fashion website with ~200k products which should be ...
1
vote
1answer
15 views

Cannot execute inserts querys after upgrade to mysql 5.7

I have Debian 8 (Jessie) server and i followed this procedure to upgrade from mysql 5.5 to mysql 5.7 https://dev.mysql.com/doc/refman/5.7/en/linux-installation-debian.html Now, any script in the ...
1
vote
2answers
54 views

How to get the PC models with identical speed?

I am trying to get pairs of PC models with identical speeds and the same RAM capacity. Each resulting pair should be displayed only once, i.e. (i, j) but not (j, i). Result required as : model with ...
0
votes
1answer
49 views

MySQL - What to store in orders or product_order

I am building my first e-commerce website and this is my current (relevant) database schema. I am very confused about what to store in the orders table or in the pivot table (order_product). I ...
1
vote
1answer
25 views

How can I do an incremental `mysqldump` without dropping table?

I'd like to fetch the last 100 rows of a table via a mysqldump, but I already have the rest of the table. How can I only fetch the last 100 rows for a mysqldump and then replace (or overwrite) any ...
0
votes
1answer
45 views

Main Purpose of FOREIGN KEY

When I did my first interview, I faced this confusing question. By using join we can join the tables, but what is the main purpose of FOREIGN KEY in mysql? Please suggest me the best answer.
0
votes
0answers
41 views

MySQL apostrophes suddenly handled differently

I have 2 production servers with exact same MySQL version (mysql Ver 14.14 Distrib 5.6.26-74.0, for Linux (x86_64) using 6.0). In one, a stored procedure continues to run properly off of a ...
1
vote
0answers
29 views

Redis along with Mysql

I'm currently working on a mobile app alike Google Maps or Wave, but also including parking. The application its running with MySQL primarily. With at this stage most of our data is loaded by python ...
-3
votes
1answer
44 views

Why different connections in database.? [closed]

I know we can use a single connection for different databases but why an option of multiple connection is provided, in other words, when is the correct situation to use multiple connections when we ...
0
votes
1answer
42 views

How to set “On Update” for uuid()

The syntax to define an update value for timestamp is the following: CREATE TABLE Example1 ( ... `RowVersion` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ... ); I ...
0
votes
3answers
50 views

Performance of updating row if content has changed

I'm trying to make a website where there is a form that contains input type fields that are editable. In fact I get the elements from one of my tables (containing an id column and a string column) ...
0
votes
1answer
20 views

Replicate View different servers

Using MySQL, and related to this answer open in another thread (How to replicate MySQL table in different servers?), It arises me the idea of replicating only a View in different servers (through ...
1
vote
2answers
48 views

scaling options for mysql on linux vm (ubuntu) : how to scale when the RAID 0 is out of space

I was asked to give a scaling road map for our mysql database. Currently, I have a single mysql instance v5.6.28 running on an ubuntu VM on azure. It has a (software) RAID 0 disk made with two 1TBs. ...
1
vote
1answer
36 views

Mysql Update columns from same table columns

I have a table where payments are located with invoice_id and payment_id and also payment_due_date => payment receiving date and period_months that is total period of the payment I have added 2 ...
0
votes
1answer
25 views

MySQL read-write Master with many read-only Slaves over shared storage?

I've asked the same question on the MySQL forum but have also seen lots of great responses here as well so thought I would try my luck here too. We have a relatively large MySQL environment where we ...
0
votes
3answers
46 views

How to select mutiple values with like clause

SELECT * from table WHERE column LIKE "AAA%" OR column LIKE "BBB%" OR column LIKE "CCC%" I have more than 10 values to select, so it is not appropriate to write like the above example. Is ...
3
votes
1answer
49 views

What indexes to use for GroupWise max

I have a user table and group table, and a many to many relationship between them. I have a vote table (one to many relation between group and vote) And a subitem table (one to many between vote and ...
2
votes
5answers
139 views

Lots of Indexes - MySQL vs MongoDB - Migrating

So, I've never used MongoDB, I just read a lot about it and I think it's going to be good for my project. Also, I do not have lots of experience with MySQL and to be even more honest I have no clue of ...
0
votes
1answer
60 views

Hashed and heap indexed object storage table insert and query performance

This question is partly to ask advice and assure this design is sane. I state the the desired properties upfront here, then go in more detail in the rationale and follow up with the design and example ...
0
votes
1answer
54 views

Repair by Sort not working

I am trying to import a .sql file which has MyISAM engine, about 51 million rows with 18 columns. The file has 1 primary and 1 unique key. I have after lurking around this site and reading mysql ...
1
vote
1answer
49 views

MySQL - Deleting old data; Select with index taking time

I am a bit confused about 2 queries. First query I am running on a 50m rows table by index on a timestamp row with a limit, I would expect the query to be immediate regardless of the size of the ...
0
votes
0answers
26 views

How can I create a user that can only create databases and users?

What I want is a user (#1) that can create other users and databases (#2, #3, n). To clarify, user #1 should NOT be able to manipulate any databases. Even the ones created by himself. Users (#2, #3, ...
3
votes
1answer
54 views

MySQL is trimming my numbers and I can't figure out why

I've got a table with a bunch of decimal(12,2) fields that are supposed to hold money amounts. For some reason which I can't figure out one of them is trimming the value when either inserted or ...
1
vote
0answers
53 views

mysql replication takes 6 seconds

I am struggling trying to understand why MySQL 5.7.11 semi-sync replication using RBR takes around 6 seconds between 2 VMs on the same physical host. I have verified the network bandwidth b/w the 2 ...
0
votes
1answer
24 views

Can I reference a specific column in a remote table (MySQL)?

I have two databases (MySQL) on two different servers, and one table references a table in the other. However, I am unable to point the reference to a specific column in the remote table for some ...
1
vote
0answers
39 views

How can I partition records vertically across machines?

I recently asked two questions: (1) how to store and connect partial records in two or more machines, with the record halves correctly associated, and (2) how to determine the increase in time/space ...
0
votes
0answers
10 views

HA_ERR_FOUND_DUPP_KEY error after pt-OST optimize

I run a simple alter to optimize a table that had a lot of stale data using the pt-online-schema tool (wrapped for readability): pt-online-schema-change --alter='ENGINE=InnoDB;' --no-drop-old-table ...
0
votes
2answers
50 views

Memory leak on MySQL slave?

I have a Percona MySQL master-slave server configuration(5.6.20-68.0). The memory usage by MySQL on the slave server is constantly growing. Now it reached 68G despite on fact that ...
0
votes
1answer
48 views

Split data across databases/machines

I have two questions about how to partition data across servers. Can I create and connect two or more databases, with the records correctly associated, using only a mapping table stored in a third ...
1
vote
0answers
19 views

Point to MySQL Binary Logs

So we have two linux servers that have a shared backup folder. The one server that is doing all the backups is working perfectly fine and has point in time recovery set up, which requires binary log ...
1
vote
1answer
45 views

systemctl startup script gives “WSREP: Failed to recover position” - manual startup works

We have a Galera crash. 3 Nodes on RHEL7. I can start one node with this command # sudo -u mysql /usr/libexec/mysqld --wsrep-cluster-address='gcomm://' 160408 13:36:24 [Warning] Could not increase ...
0
votes
2answers
48 views

How to replicate MySQL table in different servers?

I am searching for some solution for the following problem: I have two MySQL Database servers in different locations. I need copy a specific table from Server A into the same table of the Server B ...
3
votes
1answer
31 views

How to migrate from a MySQL master-slave setup to a master-master setup without downtime

We have an existing master-slave MySQL replication setup where we would like to promote the second slave to a master in order to achieve a master-master setup with no or only minimal downtime. Is it ...
0
votes
1answer
47 views

using triggers to synchronize data

i've two database, Database1 and Database2! i'd like to synchronize data from the specific table of Database1 to Database2 whenever Database1 updates. I've used triggers to synchronise data and it ...