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
1answer
328 views

Update query in a trigger

I have a configuration table: Table: refdatecol - id int(11) startdatecol varchar(100) enddatecol varchar(100) datecolTable varchar(100) This table holds the user configured column names ...
0
votes
1answer
365 views

Quickly establishing if a remote MySQL connection is valid using PHP

I have a hosted website (Namecheap Pro shared hosting) that connects to a remote MySQL database using a read-only user privilege. This remote DB is updated by a separate system. The website works ...
1
vote
1answer
24 views

MySQL error 1593 on replication between 5.5 on WIndows and 5.6 on CentOS 7

I'm setting up replication between the live server (running Windows 2008 R2 and MySQL 5.5.19) and a dedicated replication server (running CentOS 7 and MySQL 5.6.30). The CentOS box does have MySQL not ...
0
votes
0answers
64 views

Order by 2 columns with different order behavior [on hold]

I didn't know how to describe the question in the title the best way, but here's my problem, consider this data: ID grade cost 1 1 0.45 2 1 0.3145 3 2 0.054 4 2 0.4165 5 ...
-1
votes
0answers
12 views

Ranking function when ties are averaged [closed]

I am looking for a ranking function that averages ties rather than repeats them in MySQL.
0
votes
0answers
15 views

MySQL Innobackupex and Triggers, Events, Routines, Partitions

I am using Innobackupex (from Percona Xtrabackup) to take a physical backup of my InnoDB and MyISAM tables. I'm also backing up the system MySQL table, but skipping Information_Schema. Information ...
0
votes
0answers
37 views

How can I import a database from MySQL version 5.0.92 to Maria DB 5.5.47 [on hold]

I am using phpMyAdmin to export my database. Everything works on one server but on my other server it will not allow me to correctly import this data. It throws over 15,000 errors, which is pretty ...
0
votes
1answer
111 views

Moving data from one table (a million records in it) data to another table which in remote location? (MySQL)

I want to move data from one table which have more than 2 million records in size into another table which is in a remote machine, and that moving should support Logging Restart Exception handling ...
0
votes
0answers
21 views

Searching a text with space in mySql match against Query

I want to search a text in mysql DB with [space] (Ascii 32) as a part of it. But I am not getting the correct result. My MySql Query is: SELECT count(id) as total , MIN(product_price) as ...
0
votes
1answer
536 views

Restrict access to rows by usename

In my database i store data of different users (e.g. addresses or invoices) in the corresponding tables. I want to make sure that a logged in user only has access to it's own data in the tables (so ...
0
votes
1answer
33 views

how to purge / shrink .idb tables

I know this has been asked many times but, what is the proper configuration to succesfully purge / shrink .idb tables? I have tried to use optimize table table_name but after the query the .idb ...
9
votes
3answers
63k views

select rows where column contains same data in more than one record

I have a table that has a column called article_title. Let's say the table name is articles. I need to find out the records where the article_title data is the same on more than one record. Here's ...
1
vote
1answer
43 views

Setup MySQL Master to Master replication/automatic failover when each Master also has a Slave

Thanks in advance. I have always worked with SQL Server and never really had any exposure to MySQL. I now have to determine the preferred setup for MySQL when there are four servers involved. ...
8
votes
2answers
11k views

Best practices for backing up a MySQL DB

I've recently discovered that our production web servers that run off MySQL are not being backed up regularly (or at all). I'm used to backing up SQL Server DB's but don't have a ton of experience ...
1
vote
1answer
469 views

Mysql query is very slow

I am developing a website like any other social networking site using mysql. I wish it give people suggestion to my users, and I have implemented this functionality in my application, but It is ...
1
vote
0answers
20 views

UTF8 Trouble while migrating from MSSQL to MySQL with MySQL Workbench

I am tasked with migrating part of our database from an on-site MSSQL server to an Amazon RDS MySQL. This will be my first attempt with a database migration, so I am doing a dry run from our MSSQL ...
0
votes
1answer
1k views

How to insert multiple values in a specific field in a table using mysqli?

I am working on a project and I I have a scenario like this: I have many field in my table : table_name : transaction_tbl -id -name -description -ref_number : text(datatype) In my inserting here is ...
0
votes
1answer
63 views

Error 1236 - “Could not find first log file name in binary log index file”

Our setup: Master: MariaDB 10.0.21 Slave: MariaDB 10.0.17 Replication was working fine until recently at which point the slave's DBs had to be restored from a dump. I performed all of the ...
0
votes
0answers
16 views

MySQL failed connection attempts hitting max_connections

I run a couple of websites but I believe one of them is causing too many Connections Failed Attempts that causes max_connections variable to hit. Currently, max_connections=2500 (already large) but ...
0
votes
0answers
14 views

Extract an image from an SQL database using PHP [migrated]

I am trying to extract an image from my database using this code: HTML : ><img src="imagePrevie.php?ID=<?php echo $lastImage2['id'] ; ?>"><?php $lastImage2 return the true value ...
0
votes
1answer
28 views

MySQL Replication Duplicate Entry for Primary Key

160523 13:07:29 [ERROR] Slave SQL: Error 'Duplicate entry '914166' for key 'PRIMARY'' on query. Default database: 'zo_dev_20121216'. Query: 'UPDATE activity SET activity_type_id = 9, ...
0
votes
1answer
737 views

Mysql: binary log vs transaction log

In mysql with innodb, there are two types of logs: binary log and transaction log. I know transaction log is specific to innodb. But when comes to replication, backup and crash recover, what roles ...
3
votes
1answer
43 views

Slave DB promoted as Master DB when Master DB is down. New data added on the new master while old master is down

I am currently setting up a call center system (Vicidial) having a Master DB and a Slave DB. When the Master would go down, I have made a script on the SlaveDB that would execute "stop slave" on the ...
2
votes
1answer
298 views

InnoDB internals - checkpoint, LSN, dirty pages

I'm looking into InnoDB internals regarding buffer pool, checkpoint and dirtypage. However there isn't enough information to answer my question. When I run show global status, I can get ...
2
votes
2answers
369 views

Java Spring application Database triggers auditing - how to provide the right user that made the change

We are developing a new web application. one of the most basic requirement is to audit all entities changes into a separate table. We would like to use DB triggers for that purpose. We use MySQL as ...
3
votes
2answers
3k views

How to set addtime(current_timestamp, '15:00:00') as MySQL timestamp column default value?

I want to set addtime(current_timestamp, '15:00:00') as the default value of one MySQL table column. I tried to do this with the following command but failed: mysql> alter table mytable change c1 ...
1
vote
2answers
2k views

Mysql Deadlock on update query on same row

My server is experiencing occasional deadlocks on two update queries on same row both using index (primary key). The conflicting queries are: UPDATE auth_user SET rep_score=185 WHERE ...
4
votes
1answer
633 views

Stuck in “query end” status every 5 minutes

I'm sick of seeing data in the slow query log, so I decided to check out what the fuss was all about. An UPDATE query that is running up to tens of times per second is sometimes really slow. Here is ...
1
vote
1answer
461 views

How to calculate MySQL Transactions per second

How can I calculate MySQL Transactions per second. I tried to use formula (global com_commit+global com_rollback)/uptime since flush. I had also tried (global insert+ global delete+ global ...
0
votes
1answer
1k views

mysql cluster table full error

I installed a new mysql cluster on windows (for evaluation). I created a table using command below. After I insert just over 1 million records into the table it gives me the "table datadump is full" ...
1
vote
1answer
157 views

Benefits of using prepared statements in stored procedures?

Except from helping avoid SQL injection, what are the benefits - if any - of using prepared statements inside a store procedure (assume query is only executed once in the procedure)? Does the engine ...
1
vote
2answers
170 views

cannot access my DB server on ubuntu

server OS: Ubuntu 14.04 MYSQL Server version: 5.5.43-0ubuntu The output of: select User, host from user is: db % db localhost In my /etc/mysql/my.cnf, I made sure that bind-address is ...
1
vote
1answer
375 views

compare results between two select queries mysql

i'm making test application where users will input their select queries in input box and the application have to compare them if they are identical with "correct answer" query. "Correct answer" query ...
1
vote
1answer
273 views

How can I remove references to tables after removing .frm files?

So I had a bunch of csv files in my /var/lib/mysql/imports directory for importing into mysql tables I had created. To clean up the folder I deleted all the files in the directory (incorrectly ...
0
votes
0answers
14 views

$ sign showing in fields [closed]

I am working on my SQL for university, I have managed to save data from PHP to SQL but on retrieving the data there is $ sign in some fields and what I did not understand how come out of 2 same fields ...
3
votes
1answer
136 views

Should I use utf8_unicode_ci or utf8_slovak_ci?

I was using utf8_slovak_ci collation until now, but I read that utf8_unicode_ci sorts very wide range of languages. Does it mean, I do not need to use separate collation for every language and I can ...
4
votes
1answer
464 views

Storing history of full/partial tables

I'm building a web-application with Django and MySQL (InnoDB) and am currently pondering over how to manage historical changes on various tables. I wonder if it's efficient to store a lot of rows ...
0
votes
1answer
418 views

MySQL Entity Relationship Problem - 3-way join table?

This is a db relationship question. I have a scenario which I believe I have come up with a solution - however, I can't be sure it's a manageable one, or even correct. The scenario is as follows: ...
0
votes
1answer
235 views

Can I split mysql the search results into two tables in php?

I have index tables with multiple columns: s | s1 | s2 | s3 | s4 | s5 | s6 | s7 | s8 | s9 | s10 | s11 | s12 | ------------------------------------------------------------------- 0 | 1 | 0 | 1 | 1 ...
3
votes
2answers
493 views

Which one is an ER diagram?

I have started to study ER diagrams. When I browse through the ER diagram tutorials, I found something like figure 1: Figure 1 I tried to create a sample ER Diagram in MySQL Workbench like: ...
0
votes
1answer
125 views

Slow response from SELECT query

I have 50 lac rows (i.e. 5 million rows) in student table. I fire select * from student where s_name like('%something word%') limit 0,5. I define indexing on s_name column. That query takes 2 ...
-3
votes
0answers
48 views

Total newbie here: I've downloaded mysql-5.7.12-win32.zip - now what? [closed]

I've just opened an SQL manual, so it's a dumb question. But please, can you tell me what I am doing wrong? I've downloaded mysql-5.7.12-win32.zip - to actually learn by doing... And it's downloaded ...
3
votes
1answer
396 views

Bi-directional replication for the same MySQL table

AppA stores/retrieves data from dbA.tableA AppB stores/retrieves data from dbB.tableA tableA definition is the same across these databases. To start with dbB.tableA was copied from dbA.tableA ...
1
vote
1answer
44 views

MySQL syntax for order by not accepted in SQL Server

I'm working through the SQL snippets for nested sets in this article by Mike Hillyer. The article is using MySQL, but I'm using SQL Server. I get the following error reported when attempting to ...
0
votes
1answer
286 views

How to use explode mysql function in where condition with cakephp

I am using cakephp 2.6. I have payment_method fields in mysql table which store the values like 54,52,59,57 . Now my question is that how can i check if new posted payment method id is available in ...
0
votes
1answer
34 views

DDL doesn't work in MySQL master to master replication while DML can work?

I have two master in replication left master -> 5.5.47-log MySQL Community Server (GPL) rigth master ->5.5.47-log MySQL Community Server (GPL) "left master" mysql> create table test.left ...
0
votes
2answers
2k views

How to resolve “Error log file size is increasing in mysql 5.5” issue w/o restarting mysql

I have an Ubuntu server with MySQL 5.5 installed. In /var/lib/mysql a .err file is kept on updating with these warnings only: [Warning] IP address '234.22.11.221' could not be resolved: Temporary ...
2
votes
2answers
1k views

Trying to recover/import/transfer database from MySQL data dir

I used phpMyAdmin->export to create a backup of my database but I have now discovered it did not export the whole database, some tables was missed/refused. However at the time of doing the export I ...
1
vote
0answers
36 views

howto read/interpret “show engine innodb mutex” output?

We use a 3 node Galera cluster with version 5.5.41-MariaDB-wsrep MariaDB [(none)]> show engine innodb mutex; +--------+---------------------------------+------------------+ | Type | Name ...
0
votes
1answer
550 views

my.ini configuration for a huge server

I have developed a web based app in PHP MySQL and Flash Builder. It was running fine until a few days ago when the client began to connect a lot of users. Then the app started to freeze and sent ...