The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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.

Filter by
Sorted by
Tagged with
0
votes
1answer
11 views

How to connect two attributes without a PK (MySQL)

I'm a new programmer and I'm doing a database on MySQL with phpmyadmin. I have this doubt - I know that if you want to link two different tables you need an attribute that is a Primary Key, and ...
-1
votes
0answers
10 views

Can you edit DB content, if you can't access phpmyadmin? [on hold]

I've crashed my domain's DNS trying to enter a DKIM entry to my control panel, now I can't access my domain, my control panel or PHPMyAdmin because they all reside on my domain. Is there a way I can ...
0
votes
0answers
9 views

Mysql vsz keep growing until OOM

cat /etc/redhat-release CentOS release 6.5 (Final) thread variables join_buffer_size 4k read_buffer_size 2k read_rnd_buffer_size 4k sort_buffer_size 4k key_buffer_size 2k tmp_table_size 64M ...
0
votes
0answers
13 views

MySQL replication still failing after new import

I had an issue with my MySQL replication from Master to Slave. An App we had by mistake wrote to the Slave and deleted some data as well, causing errors during the replication (delete errors, primary ...
-3
votes
0answers
34 views

can anyone answers these im new to database [on hold]

a. List the first name, middle initial, and last name of all employees who earn a salary greater than 27,000. b. List the first name, last name, and address of all employees who have a son as a ...
1
vote
1answer
29 views

(MySQL) SET column with values from a foreign key constrant

I am making a junction table that tracks relationships between users. Among other things it is formatted with a group leader, and with a variable amount of members. All users have a user id and so ...
-1
votes
0answers
23 views

How to get all previous week record by using creating a imaginary column

I have problem an now this is more than 2days and I can't find any answer. can you help me out guys. to solve my problem. I use Server version: 10.4.6-MariaDB Question: How to get the all records ...
-1
votes
1answer
40 views

Return the last purchase for each item in a group

I'm trying to calculate the cost to make one product, for this I have a table with the data sheet to build each product. So, for example, to make the Product A I'll use item a, item d and item g. ...
0
votes
0answers
19 views

Order by inside the LEFT JOIN

I am trying to write a query. I got it work half way, but I am having problems with the LEFT JOIN. I have three tables: user user_preferences user_subscription_plan User will always have one ...
0
votes
1answer
22 views

Documentation on usage of brackets() in mysql queries

I have an application where i am needed to write queries with multiple conditions and i am using several other keywords such as between, and, or etc I have this two conditions select * from ...
0
votes
1answer
11 views

How to select any couple of digits except '00' using mysql regex subset syntax?

I just found out that mysql doesn't support full regular expressions syntax. I have to select any couple of digits except of 00 (so, 11, 54, 02, are ok, but not 00). Normally I would use a negative ...
0
votes
1answer
14 views

how to make error log visible in ubuntu

despite starting mysql sudo service mysqld start How to give permission to var/lib/mysql
0
votes
0answers
13 views

Preventing query to stay in pool

How can I prevent my finished queries to stay in pool? Below is the image of my database and a lot of my finished queries are staying and I want them to be removed but don't know how. This is my ...
0
votes
1answer
19 views

how do i get rows for each month which contain the store with the highest number of purchases?

how do i get rows for each month which contain the store with the highest number of purchases? my code is: SELECT DATE_FORMAT(buyDate, '%M') as month, count(id) as numPurchases, store from ...
0
votes
0answers
12 views

Is it safe to leave/exit the stored procedure without commit or rollback on a transaction?

Like the code below is it safe to do that? create definer=`root`@`%` procedure `test`() label: begin declare exit handler for sqlexception rollback; start transaction; select condition from table ...
0
votes
0answers
11 views

prepared statement returns NULL, unable to retrieve the column value

I'm creating a procedure where it will iterate over every column in a table and get maximum value of every column. This is my code: DELIMITER // DROP PROCEDURE IF EXISTS min_max // CREATE PROCEDURE ...
-1
votes
0answers
7 views

sql workbench 8.0 error

I need to open table that:represents what owner adopted what animal (the relations is one to many) ● Primary Key is the combination of both ​owner_id​ and ​pet_id ● owner_id​ references ​id ​from ...
0
votes
1answer
19 views

Dates values displayed 0000-00-00

I have imported a csv file into my database created in phpmyadmin using sql. Server version: 5.6.37 - MySQL Community Server (GPL I have a column for dates which has a datatype of date. The data ...
-1
votes
0answers
12 views

error when I try to open table on sql 8.0

I need to open table that represents what owner adopted what animal (the relation is one to many). I start with foreign keys and some columns but after I try to open that table, I get an error This ...
0
votes
0answers
29 views

How can I find where FK = PK in the same table?

I have one table named employees which contains employees' IDs (which is PK)-stands for managers-and reportsTo(which is FK). I don't know what is the correct condition to find which manager is being ...
1
vote
0answers
18 views

Determine if “item” in parent table or child table

Is there a way to know or compare two tables, here are of course 6 tables. Two act as linking Tables, while the other ones hold data. I want to be able to determine if the item is in parent or child, ...
0
votes
0answers
22 views

Grant `UPDATE` right on MySQL non-system schema?

After doing some tests and despite not seeing any warning in MySQL documentation, it seems that a user who has UPDATE right on all databases can do updates in the mysql.user table, and so, this user ...
0
votes
1answer
14 views

How to query mysql tables with regular expressions?

I'm using a correct regex, already tested with other tools. But in mysql seems not to work properly. Say this data: And I want to select all the records which start with 2 non-digits followed by a ...
-1
votes
0answers
29 views

Urgent Help with stored functions in MySQL

need urgent help with this question. I do not know how to approach or tackle it. "Write the code to create a stored function isNutFree(coneNumber INT) that returns TRUE if every part of that cone is ...
-1
votes
1answer
19 views

Unable to declare user-defined variable in MySQL

I'm creating procedure called min_max to find minimum and maximum for every column in a table. But I'm encountering an error for declaring the variable. See below: DELIMITER // DROP PROCEDURE IF ...
0
votes
1answer
10 views

Update Mysql records using Same table but Based on same table record

I have table in which i want to update records based on it's 'wishlist_id' value. Sample format of table records. Expected table record after update. So can you help to update this record using ...
2
votes
1answer
27 views

SUM counts from parent and child

With this SQL-query, I am able to obtain the count(*) of items in subcategory, but I want to be able to SUM total items, from both main (parent) category and subcategory (child), how can this be ...
-1
votes
0answers
60 views

Creating a stored function for mysql [on hold]

I have to create a stored function for Mysql. Write the code to create a stored function isNutFree(coneNumber INT) that returns TRUE if every part of that cone is nut-free, and FALSE otherwise. At ...
1
vote
1answer
23 views

LOAD DATA keeps CPU usage high after it finishes

I'm loading multiple files into the database using the LOAD DATA LOCAL INFILE command combined with Golang database/sql driver like this: mysql.RegisterLocalFile(fileName) _, err = dbConnection.Exec(...
0
votes
0answers
16 views

Cannot connect to RDS Aurora Mysql Database Even Though It Exists

We have an RDS aurora mysql instance that has been up and running for a while without issue, however, today our application's connection to the db failed, with error ERROR 1049 (42000): Unknown ...
-1
votes
1answer
21 views

MySql query suddenly became very slow after a while

I have a program that reads a set of entries from a database, performs some set of operations on these entries, and updates them in the database, the select query is pretty straight forward, It just ...
0
votes
0answers
15 views

Explain plan : Why rows examined higher in this cased? [duplicate]

I have 450 million records in my table which contains the data for around 7 to 8 months. So per month data is around 60 million records. Table has index on empDate. When I execute below query , I ...
0
votes
0answers
32 views

Altering a SET colum Type [on hold]

ALTER TABLE `tablename_1` CHANGE `members` `members` SET('name von lastname','çiao dela cya','María L. Cyález', 'ćya Later','NewName Added') CHARACTER SET utf8mb4 COLLATE ...
0
votes
3answers
31 views

Generate random timestamp taking into account shift to daylight saving time

I want to generate random big data in MariaDB. One of this columns is random timestamp which I generate like this: select (current_timestamp - interval (rand() * 60 * 60 * 24 * 365 * 10) ...
0
votes
0answers
17 views

ALTER TABLE causing transaction aborted

There are two transactions. One transaction I used BEGIN RO for read-only transaction. While the other one I used BEGIN to allow me adding a new column to my table called dummy_table. This is what I'...
0
votes
2answers
26 views

how to duplicate each row of a mysql table?

I've got a table of Product records from an old db that I must change to import on a new php system. They have the form: name, property1_IT, property1_EN, property1_FR I need to transform them by ...
0
votes
0answers
16 views

MySQL hidden files on ubuntu taking up space

I have a weird issue where my system (ubuntu 19) is showing that MySql 8 is using up 600gb of space, when it should be closer to 250gb. I ran ubuntu's baobab utility in sudo mode, and it as well, is ...
0
votes
1answer
13 views

MySQL InnoDB add new instance to existing cluster

Server version: 5.7.23-log MySQL Community Server (GPL) I'm running an InnoDB cluster and trying to add a new node, the cluster is a couple of years old and binlogs are being cleared after 2 weeks. ...
1
vote
0answers
14 views

mysql data node not connecting to node manager on AWS EC2

I am trying to setup mySql manager + data node + sql server (Server A) and another data node cluster on (Server B). Both running on Ubuntu 16.04 amd_64 Server A /etc/hosts also on Server B Both ...
0
votes
1answer
13 views

Merge multiple rows in table setting one column based on value in rows

I have some data that looks something like this: key B 1 true 1 false 2 false 2 false And I want to roll it up so that if column B has two false values then the resulting value for B is ...
1
vote
2answers
21 views

ALTER TABLE DROP COLUMN - server status 'Stopped'

I am in the process of removing 4 columns from my (MySQL/innodb) table, simple code, ALTER TABLE database_name.table_name DROP COLUMN A, DROP COLUMN B, DROP COLUMN C, DROP COLUMN D; It has been ...
0
votes
1answer
24 views

MySQL - too large temporary table on disk

I have two servers with identical MySQL versions (5.5.50, pretty old), identical my.cnf, identical SHOW VARIABLES and three identical tables with identical indexes and different data. And I have a ...
0
votes
0answers
13 views

Getting Connection Error on MySQL5.1 to MySQL8.0 ROW Based One Way Replication

Trying to replicate MySQL5.1 to MySQL8.0, when running starting the slave on MySQL8.0, I get [ERROR] [MY-010584] [Repl] Slave I/O for channel '': error connecting to master 'rep_user@XXXXXXXX.YYY:...
0
votes
1answer
32 views

Import a large MySQL dump 68GB on RDS instance

I tried to import a large MySQL dump.sql (68GB) on RDS AWS instance MySQL 8.0 (db.t3.2xlarge: 32GB RAM). The import takes more than six hours: More than 500 tables I have 2 large tables: the first ...
-3
votes
0answers
14 views

How to read millions of records effectively with more joins? [closed]

Im developing an enterprise application using node js as backend and mysql for database for one of the telecommunication company. I'm currently working in rewards module like grabbing and redeem ...
0
votes
1answer
21 views

Select count date from multiple where conditions for each day

I have lot of coupons. I would like to learn for each day how many coupons from each campaign have been received by users. But I cannot write something like assigned_date for each select row SELECT ...
1
vote
2answers
54 views

SELECT LATEST ENTRY ON GROUP BY

This query doesn't return the "latest" entry, rather it returns the "older" rows: SELECT MAX(ID), ID, NEW_BALANCE, DATE, NAME, ACC_NO FROM ( SELECT ID, NEW_BALANCE, DATE, NAME, ACC_NO FROM ...
-5
votes
0answers
21 views

Please tell me query to solve the following question? [closed]

Display the doughnut “Name”, “Cost” and “Sale Cost”. A sale cost is a calculated column of one doughnut at 30% reduction.
0
votes
2answers
18 views

Group by specific value and return results in generated column

I am attempting to figure out how I can pull this off, but I have no clue how to do it. I have a table (below) that has object_id's, types and values. The values are always unique and the type is ...
2
votes
2answers
51 views

Is this the correct/best way to create a custom column in mysql?

I needed to select certain records from a selection with a custom column that have another column's modified value as its own value. The following query just works for my needs. But I wanted to know ...