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

1
vote
1answer
9k views

mysql trigger to insert/update date column from datetime column

probably simple question but can't get it to work: I have a table with two datetime columns. In order to set up a date index and have simpler queries, i have added two date columns next to them. Now,...
0
votes
0answers
13 views

MySQL: Updating a column referenced by two foreign keys in the same table leads to foreign key constraint failure [duplicate]

MySQL 5.5 I have a simple InnoDB table: CREATE TABLE `T` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `deleted` bigint(20) unsigned NOT NULL DEFAULT '0', `other` varchar(32) DEFAULT ...
1
vote
1answer
487 views

Mysql trying to recover from Hard disk failure [duplicate]

Am trying to get a database up and running after having a hard disk crash, got the data recovered. mysql can only start with the innodb_force_recovery set as 5 or 6. When started I can get a table ...
0
votes
1answer
290 views

Is there any way to trim data automatically

Lets I have a table named myTable in mysql with Three field 1. id int autoincrement 2. product_id varchar(20) not null 3. product_name varchar(200) not null Now I want to keep data in product_id ...
1
vote
1answer
1k views

InnoDB to MyISAM Conversion Problem

I have a dedicated server based on CentOS 5 OS , mysql 5 and phpmyadmin I was trying to convert all database tables from InnoDB to MYISAM. I tried to do it by setting in /etc/my.cnf file the value ...
0
votes
0answers
550 views

Issues with mysqldump after upgrade 5.5 -> 5.6

A few months ago I updated a MySQL setup from 5.5 to 5.6. Since then I've been having problems with a script that I use to dump the various databases so that I can back them up. The script is a short ...
0
votes
1answer
966 views

importing database backup to phpmyadmin return #1064

When I tried importing mysql database backup to MySQL using phpMyAdmin I got the following error message: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your ...
0
votes
2answers
210 views

Database setup/design for multiple services

I am working on a new MySQL database that will store orders/customer information for around 15 different services. 7 of the services are similar in regards to the information that is stored with a few ...
2
votes
1answer
7k views

select based on sum of rows compared to another field value

I have a table of invoice items. A single transaction may result in multiple debit items and multiple credit items sharing the same invoice_set_id, I need to compare the sum of the debit items against ...
4
votes
1answer
11k views

MySQL: Migrating database with utf8 collation and charset but latin1 data to new full UTF-8 database

With my current situation I have mysql database with collation and character sets on database and tables set to utf8, but all data is still latin1. This is due to server being configured (my.cnf) with:...
0
votes
1answer
2k views

SUM a new value to an existing value

I have a php script which processes a form with a single input. I want the value I send through input to be added to an existing value in database (mysql). For example in database I have value = 10 ...
0
votes
1answer
526 views

CHROOT install after I already installed Mysql 5.6

I installed some time ago Mysql 5.6 on Ubuntu server 12.04 and now I'd like to enhance security by putting mysql into a CHROOT environment on that same Ubuntu server. Is this possible without re-...
0
votes
2answers
1k views

Select * on inner join with common columns

I have 3 tables (mysql db) on which I want to do an inner join. The problem is that these tables have common columns. I know I could use aliases to differentiate them (select A.x as Ax, B.x as Bx, C.c ...
3
votes
1answer
5k views

Multiple “root” users in MySQL

Mysql is showing 5 root users: | root | % | | root | 127.0.0.1 | | root | ::1 | | root | localhost | | root | mysrverhostname | What are these 5 for? Are there some I can ...
2
votes
1answer
232 views

In MySQL, does the order of the columns in a WHERE clause affect query performance,why? [closed]

I have a query that doesn't use any indexes: SELECT 32, guid, 1, 1, 1, 0, 5 FROM test WHERE level >= 20 AND ( ( fun_GetIndexValue(data, 354) >...
0
votes
0answers
894 views

How to recover a crashed MyISAM table which myisamchk couldn't recover?

We take db backup by stopping the database and then issuing a tar -zcf on the mysql data directory. When we restore the data directory on another machine and try to start the slave, the mysql error ...
1
vote
1answer
3k views

Recovering MYSQL databases

I needed to reinstall the WAMP server on Windows and in the process it reinstalled MYSQL as well. Now when I login to phpmyadmin, I can see my databases with the tables listed on the left side ...
2
votes
0answers
602 views

Upgrading from MySQL 5.5 to 5.6 - timestamp issue?

I'm looking at upgrading my Percona Server setup from 5.5 to 5.6. Reading the upgrade docs from MySQL sounds mostly straightforward except for anything involving time/date columns. As far as I can ...
1
vote
1answer
792 views

Configure MariaDB PAM authentication, and enabling remote login from Toad

I am currently trying to integrate Linux services into my Windows environment and have installed MariaDB with PAM authentication following the guidance from MariaDB. I have tested successfully on ...
1
vote
1answer
893 views

Restoring backup from mysqldump does not remove additions

I am restoring a backup from a mysqldump and noticing that if I made additions (in the form of new tables) to the database they persist after the restore. I can go back in and remove those tables to ...
2
votes
1answer
2k views

Tool to Convert MySQL DB to MS SQL 2005 (Especially stored procedures) [closed]

Is there any tool to convert MySql db to MS SQL 2005. I am mostly interested in converting Stored Procedures. There are 100s of procedures and writing them again in T-SQL is a big job. Thanks.
0
votes
1answer
178 views

How to Revoke and Re-grant Permissions for an in-use MySQL User

We have a user which (wrongly) has global privileges (i.e. *.* rather then database specific). We would like to restrict this user to one database, so my approach would normally be to REVOKE ALL and ...
0
votes
0answers
2k views

How can I backup/dump MYSQL database with foreign key constraints?

I wanted to take the dump of the MySQL database with all the constraints on that database. The dump (.sql file) I am having right now don't show any reference key(foreign key) relationship. I am ...
0
votes
1answer
1k views

High rise in Aborted_connects on mysql slave servers

I have a MYSQL replication set up where I have a single master and three slave DBs. The slave DBs are load balanced behind a Zeus Load Balancer. I can see on slave DB servers that the ...
0
votes
1answer
235 views

Can't get rid of “temporary; Using filesort”

I can't get rid-off "temporary; Using filesort" when ordering columns from the second table explain SELECT * FROM post JOIN post_plus ON post_plus.news_id = post.id ...
0
votes
1answer
37 views

Using Auto Increment and Not Null

Is there any point in following up a AUTO INCREMENT with a NOT NULL? Seeing as the db takes care of this, I assumed a AUTO INCREMENT will always have a value?
0
votes
1answer
84 views

MySQL warm up time after restart because of lost connection

MySQL 5.6.10 on Windows 7. I'm cleaning up and paring down a large INNODB table. Its .ibd file is originally 22 gigs. While I was in the middle of an ALTER, dropping some columns, the mysqld.exe ...
0
votes
0answers
349 views

How do I perform a batch update on the first n matching rows?

I need to perform a large number of updates at the same time. Each update needs to only affect up to a specific number of rows even though the WHERE clause might match to many more rows. So far, I'm ...
0
votes
0answers
32 views

Which of these two queries is better - can be optimized more?

With regards to the usage of the IF statement, which is better to use? Query #1: SELECT whatever FROM auctions AS a LEFT JOIN ............... WHERE ............... ORDER BY IF(a....
0
votes
2answers
1k views

Cannot stop MySQL 5.5 replication threads

We have a master-master replication setup using MySQL 5.5. On one of the servers I am trying to stop the slave thread, but without success. To ensure that the replication does not connect to a real ...
1
vote
3answers
840 views

MySQL “lost” all data(InnoBD)

Today I was making some work with site and I get error what MySQL can't rename file (to make changes in BD). Next I tried to restart MySQL, and it failed to stop MySQL. Then I did go to /var/lib/mysql ...
1
vote
1answer
2k views

MySQL Workbench - Creating a one-to-one relationship using existing columns?

How do I create a one-to-one relationship using existing columns in MySQL Workbench? I have an EER diagram tab open and I am selecting from the toolbar on the left hand side. Unfortunately it seems ...
1
vote
0answers
431 views

restore using mysqlbinlog failing

While doing restore from a MySQL binary log file, it is failing with the following error . mysqlbinlog mysql-bin.000036 | mysql -u root -p asdb ERROR 1032 (HY000) at line 48: Can't find record in '...
1
vote
0answers
851 views

USING to join multiple tables with same field

I have 4 tables, each with a common field QuestionnaireId. I am wondering if there is any difference in output or performance difference between using USING on the field in each join or by specifying ...
0
votes
0answers
25 views

Connecting mysql on server A/ to webapp on server B/

I am connecting mysql on server A/ to a webapp located on server B/. Both servers are Ubuntu servers. For security purposes, is there any way on server B to avoid showing the full path / IP address ...
1
vote
0answers
111 views

Output datetime from MySQL with offset

I'm currently writing to a datetime XML field from MySQL data. The MySQL field is populated with current_timestamp() but this only outputs - 2014-02-18 15:34:02 whereas I need something like 2014-02-...
1
vote
2answers
1k views

MySQL replication: slave not updated

This has been asked many times over but we really cannot get a simple Master-Slave Mysql (5.5.25) replication to work for our two dbs (FatTree and Torus). And no trace of error in the logs. The ...
1
vote
2answers
612 views

Connection refused when trying to set up replication

I set up replication. I've done this on two servers so far, and it's worked. Third time unlucky, as it were. The production server is CentOS 6.4, and the replication server is CentOS 6.5. The prod ...
0
votes
2answers
151 views

How to store a database table in multiple disks with assigned ratio?

I am going to deploy database tables to multiple disks. My database layout would be like following example: There are 3 tables (Customer, Order, Product) and 4 disks (disk_A, B, C, D). Customer: 5% ...
0
votes
1answer
109 views

MySQL: What points should we consider when create composite index

There are multiple views behind the logic of creating composite index in a table. Creating composite index is obvious when we have composite primary key. Beside this, we create composite index on the ...
1
vote
2answers
132 views

Backup architecture for frequent backups of business critical DB

We've got a database (mysql) driven application which contains business critical information, were looking at building a system that will allow us to backup the db frequently (every 15 minutes, ...
1
vote
1answer
583 views

Error while importing sql - Specified key was too long; max key length is 1000 bytes

I am trying to import an sql file which shows me the following error: Error SQL query: -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE ...
6
votes
1answer
697 views

MyISAM with Innodb in the same Wordpress database reduce performace?

My new Wordpress database all the Wordpress created tables use InnoDB engine and plugin created table use MyISAM. But older site database all the tables use MyISAM table engine. I use MySQL 5.5.35-...
4
votes
1answer
130 views

Settings for a MySQL backup only slave instance

I have two instances of MySQL running one a server, set up as master and slave. It's all working smoothly together and I'm only using the slave instance for backups to avoid locking up the live ...
1
vote
1answer
141 views

How to relate 2 user profile tables to a single login table?

I have an Employee table , and another table named Student. Now I have a third table named the Login. Employee has emp_id as PK , and other specific attributes for an employee. Student has std_id as ...
0
votes
2answers
1k views

What is the performance difference between IN (42) and id = 42 in MySQL?

Are there any performance differences between SELECT * FROM table WHERE id IN (42); and SELECT * FROM table WHERE id = 42; ? The question is about just supplying a single value. The ...
0
votes
1answer
683 views

Digital content eCommerce schema advice? [closed]

I don't have much experience designing databases, I'm looking for some advice on my design from more seasoned designers/developers. I'm developing a digital content eCommerce store which will be ...
0
votes
1answer
93 views

Ask about Inner Join & Union

i want to ask about my script this is doesn't work. i need to help ! SELECT A.*,B.mat_nama,C.mats_nama FROM pengeluaran AS A INNER JOIN(material AS B) ON(A.mat_id = B.mat_id) INNER JOIN(mat_satuan ...
2
votes
1answer
603 views

row locking within ACID transaction innodb

I have a financial transaction that looks something like this (pseudo): begin select record for update update record(same record as selected) insert another record into another table ...
2
votes
1answer
808 views

Can I configure MySQL replication to break when I run a “drop database” or “drop table” command on the master?

Basically, what the title says. This would enhance the failover quality of our systems, becuase we have run into issues of people thinking that they were in a test environment running drop statements ...