Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
2answers
24 views

Finding MySQL Tables with no primary key OR no composite key

I can easily find tables that do not contain a PK from information_schema, but I'm having a tough time writing the logic to find tables that might contain neither a PK nor a Composite Keys (via two ...
0
votes
1answer
16 views

Pulling a username from table one to update credits on table 2 under the same username

I currently have 2 tables, one being a table that stores votes, and the other being the members table. I want SQL to pull the username from the "votes" table (as this keeps track of who voted), then ...
0
votes
1answer
30 views

Limit groups of results based on a column value

I'm not sure I formulated the question properly, but anyway. I have a table with level-2 comments, some of which, expectedly, have the same comment_parent column value. How do I make a SELECT query ...
0
votes
0answers
13 views

User Permissions - Department(s) and Sub Role(s)

Good afternoon, I am relatively newer to MySQL and I am looking for help to change a database structure up to allow more specific permissions based on sub roles. Currently, my database is only using ...
0
votes
0answers
12 views

MariaDB Galera journalctl

I've noticed something weird. I have 3 nodes galera cluster, installed using mariadb. I'm pretty sure that I did all three nodes installations exactly the same. All three nodes display their --...
0
votes
2answers
34 views

How to get the best time from submited values?

I have a MySQL table, and i'm trying to figure how can i get the first result for each user. For example: Email Time DateSubmission usera@email.com | 0:14 | 28/2/2019 00:10 usera@...
0
votes
1answer
18 views

How to install keyring_aws plugin in MySQL?

I am looking for a way to install keyring_aws plugin in mysql community edition. Is it possible? I gone through couple of docs, https://dev.mysql.com/doc/refman/5.7/en/keyring-aws-plugin.html ...
-1
votes
1answer
23 views

MariaDB - Epoch date comparisons

On MariaDB 10, I'm trying to work with dates, particularly whether the current date is within 7 days of a date stored in the database. A longtext column holds an Epoch datetime, which I convert into a ...
0
votes
0answers
9 views

MySql module in xampp server is not starting..Getting following error log:

Error: MySQL shutdown unexpectedly. 3:30:57 PM [mysql] This may be due to a blocked port, missing dependencies, 3:30:57 PM [mysql] improper privileges, a crash, or a shutdown by another ...
0
votes
0answers
40 views

MYSQL - how can use a field of current record as a where clause in a sub query

Ok. I want these info from each user record. user.username user.fullname report_qty so the first two fields exist in the user table. but the last one should be computed from ther tables. i have a ...
2
votes
2answers
27 views

AdonisJS: is something wrong with belongsTo() relationship design?

In AdonisJs framework, suppose we have a Profile model in which we define belongsTo() relationship to theUser model. The documentation says this will lead us to define our databases this way: The ...
0
votes
0answers
22 views

Data model for handling time intervals with possible overlaps (booking system)

we are trying to make a booking system where supervisors can scedule halltimes (Halltime class), in which student assistants can make themselves available within the assigned halltimes (HalltimeTA). ...
0
votes
0answers
19 views

mysql “link/reference” (not copy) values from a table to another

just starting learning mysql. here is what i am trying to do: table meds: id small int not null unsigned auto_increment name varchar not null category varchar not null primary_effect varchar ...
0
votes
1answer
19 views

using view (necessary) with where conditions (dynamically)

Suppose we have two tables like A {a1, a2, a3 ...} and B{b1, b2, b3 ...} We are using a MySQl view like Select a.a1, b.b1 from A a Left JOIN B b ON a.a2=b.b2 Now our requirement is that we have ...
0
votes
0answers
23 views

Why sum with previous and current column do't working

I want to update my specific row with that row previous value, after searching i found some post about this but those solution not working with me. So what is wrong with my query or how can i ...
0
votes
2answers
40 views

MySQL 5.6 @ AWS RDS read IOPS plateaus lower than write IOPS

I have an RDS MySQL 5.6 instance which plateaus ReadIOPS at around 6.5k. My WriteIOPS is most often lower, but sometimes higher than ReadIOPS, but has never entered such a rigid plateau. The disk was ...
1
vote
1answer
47 views

How to safe delete (shred) a MySQL database?

I want to store sensitive data in a MySQL database for a while, so I'd like to know a way to delete a MySQL database without having a chance of recovery. In Linux, we have a tool named shred which ...
0
votes
1answer
22 views

MySQL Cluster - SQL node fail to connect Management Nodes

I am trying to deploy a 2 machines MySQL NDB Cluster with the following architecture: 192.168.1.12 – management node 192.168.1.12 – SQL node 192.168.1.12 – data node 192.168.1.13 – SQL node 192.168....
0
votes
0answers
23 views

How to group related information: Another table vs Same table

I have a table to store video information, like so: ----------------- video ----------------- video_id title description duration inserted_date ... Many times, i have videos that are directly ...
0
votes
1answer
25 views

schema of messaging system

in a web application where people talk to each other , there will be a lot of messages , suppose for simplicity that each row in a table is a message , do you think if a have 5 million messages that ...
-1
votes
2answers
35 views

How do i get a field of the last inserted row?

Using mysql: I am inserting a row into a table with one auto_increment field left as null (so that gets auto-filled). How would i go about getting the auto incrementing field in a new query that ...
0
votes
2answers
24 views

Mysql could not be started because unknown variable 'log-syslog=1'

Platform System: WSL(ubuntu 18.04). when installed mysql-server 8.0 sucess, i try to start mysql. But it's fail to start.Then checked the error.log. 2019-02-26T03:13:51.609895Z 0 [ERROR] [MY-000067] ...
0
votes
0answers
15 views

Tables missing from MySQL database after removing then restoring the mysql data direcory

I Carried out the following operations. make mysqldump of testdb # Stop service /etc/init.d/mysql stop # Create copy of directory cd /var/lib cp -R mysql mysql.backup # Delete datafile on disk rm -...
0
votes
1answer
58 views

MySQL thinks Master & Slave have same server-id, but they don't

Trying to setup MySQL to run one-way replication. I have the master set to server_id = 1, a replication user setup, binary logging enabled, the Slave server_id = 2 and is connected and waiting for an ...
0
votes
1answer
26 views

MySQL GROUP BY query drastically slow down when after data reaches a certain amount [closed]

I need help finding out why the following query that aggregates peoples' responses by "item" slows down considerably after the data being aggregated reaches a certain size. select t1.item, count(...
1
vote
1answer
24 views

How to drop column named `

I managed to create a column in my MySQL database named ` (the backtick character). How can I delete it? Is there a way to escape the backtick character in a query?
0
votes
1answer
50 views

django_session table killing my MySQL server and django app

I need your help I hav a Django app that is about 7 years old and have been degrading now..every time the website goes down and back up and the issue is with mysql server Usually i need to just ...
0
votes
2answers
34 views

Two mysql select queries into one query

user id | name 1 | A 2 | B article id | title | descritption 1 | wx | xyz 2 | yz | abc article_rating article_id(article->id) | given_by(user->id) | ...
0
votes
2answers
30 views

How does MySQL store data, can I detach a mysql Database?

I have used SQL Server in the past which each database is kept in separate files (a data file and a log file) but things are different in MySQL as it seems. The file sizes of these files translates to ...
0
votes
0answers
28 views

MYSQL trigger syntax for CONCAT

I am creating a trigger which should be really easy, but I cannot get past the set @code line? What am I doing wrong? There is an ID column in the wp_users table. CREATE TRIGGER affiliate_insert ...
-1
votes
0answers
13 views

repalce query with left join and not in

i write a query with NOT EXIST like this > select id_request,username_request from darkhast_follower where > darkhast_follower.id_request != '9762952594' AND > darkhast_follower....
1
vote
1answer
37 views

Advice on fine-tuning query and index for performance

Currently my query is as below: select id_request,username_request from darkhast_follower where darkhast_follower.id_request != '9762952594' AND darkhast_follower.status =0 AND NOT exists (...
1
vote
2answers
24 views

Improve speed of GCP SQL Failover

I've been trying out GCPs SQL high availability options. Is there a way to improve the fail over speed? Attempting manual failovers through the UI takes literally over 5 minutes where mysql is ...
-1
votes
0answers
43 views

Mysql offline online database sync

We have built a software web-portal (Accounting Software) in PHP language. But when the internet goes down in the stores, the software stops completely and the staff are not able to work until the ...
0
votes
1answer
49 views

Not unique table/alias: 'tbl_users'

I have difficulties with my codes in inner join. I need to join 4 of my tables but it has a error: "Not unique table/alias: 'tbl_users'" and when I added alias my table didn't recognized and its ...
0
votes
0answers
28 views

Sync local mysql database and live server database?

Someone answer the question on the below but he did make it clear, I can't see code where he connect to Database how to combine the file (Footer.php, Config.php, Sync.php, sync_server.php) Please I ...
1
vote
2answers
18 views

How to create a database that is a randomized subset of another db (mysql)?

I have a MySQL-DB containing 2 tables "records" and "features" linked by one foreign key in features referring to the primary key "id" in records. My goal is to create a randomized but fixed subset ...
0
votes
1answer
22 views

Reducing latency in read operations

Table size 45 million rows Schema: item name, categories and subcategories, order quantity and price. What is the fastest way to put each item into an appropriate bucket? For example: price range ...
0
votes
0answers
16 views

MySQL (phpmyadmin) update query from one table to another table

I have an issue with my SQL query as I have two tables named Student_Summary and Fees_Master. In Student Summary I have a column named Admission_fees and in fees master we have Fees_Type. For fees ...
0
votes
2answers
76 views

Optimize MySQL update statement

I have an update query that selects data from a table (HST) and updates it into another table (PCL). The PCL table contains ~30000 rows while the HST table contains about 1.1 million rows. I have ...
-1
votes
2answers
73 views

Which has better career prospects : PostgreSQL or MySQL? [closed]

I am a Senior Oracle DBA. At the moment , my DBA career is not affected by the rise of open source databases. But, It might not stay like this for long. To make my career future proof, which open ...
1
vote
2answers
43 views

Restarting Mysql makes application fast

I have a Drupal 7 application running a large Mysql database. It's built on AWS instance (30GB RAM, 8 CPU). Below is the my.cnf copy. Issue is that my application gets noticeably fast when I restart ...
0
votes
2answers
24 views

how do I get extra fields with in a column with calculations

I have a table AR--X with columns as Region, Product type, pofit, Target, 1, 2, 3,....... till 31 ( days ) as columns. In Product type Column, there are fields like Electronic, Plastic, wood, other, ...
0
votes
0answers
18 views

How to insert into a MySQL table column, known its name as string?

I want to insert into a MySQL table (child table) column a certain value(int value). I know that the column name is: 'parent_data_ID' But that column name is got from the following command: SELECT ...
0
votes
0answers
30 views

MySQL InnoDb crash when importing tablespace from remote machine

InnoDB crashes when importing ibd file from remote machine. Source version is MySQL-5.6.40, Destination version is MySQL-5.6.40. Database was backed up was backed Percona Xtrabackup with xbstream ...
1
vote
2answers
27 views

Show difference between mySQL tables

I want to display difference between tables by returning the names in table 1 that are not in Table 2. Table 1: +----+-------------+----------+ | id | campaign_id | nickname | +----+-------------+---...
0
votes
2answers
25 views

Single-column user defined variable based on a comparison

I have a database with over 300k lines and each row is a separate timed event. I have a column of system spec values for error, followed by a stochastic draw on an actual error for that event. I can ...
0
votes
1answer
25 views

Safe online dumping of an InnoDB database in the presence of DDL changes

When dumping an InnoDB database using mysqldump, it is often recommended to use the --single-transaction and --skip-table-locks options. This allows for minimal blocking of other concurrent reads + ...
2
votes
1answer
26 views

Sub query not working as expected trying to order by then group by, MySQL 5.5 vs 5.7

I do not know/understand DB's as well as I would like. I'm trying to ORDER BY and then GROUP BY so that I get the first record from each group of results in the database. -- Example table (just an ...
0
votes
1answer
21 views

Two-sided LIMIT in MySQL

I have a table with 4 rows of data always in the same order. What I want to do is to limit the query to just get the 2th to 3th row. for example a table 'food' with: cake pizza chocolate lettuce ...