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

2
votes
2answers
127 views

General structure advice for beginner

I am starting my first DB-Driven website project for a mock real estate agency and would like a bit of feedback on my general approach to how I will drive the site with the DB. Specifically I'm ...
1
vote
1answer
554 views

Optimizing a large number of INSERT … SELECT statements

I have a MySQL InnoDB database with two tables related by a foreign key. Each time a row is inserted into one it uses an INSERT ... SELECT statement from the other to get the corresponding foreign ...
1
vote
1answer
163 views

MySQL Enums have non-intuitive behaviour, why?

This very helpful article explains some oddities about how MySQL Enums behave: http://melp.nl/2009/05/mysql-enums-and-booleans/ There is no discussiong about why that behaviour exists. Furthermore, ...
0
votes
0answers
39 views

Trying to import an addressbook

I'm trying to import a .sql-file that I got by converting an .dbf-file. The problem is this line: INSERT INTO address values ('', '', 'Dekanat', '', 'Fachhochschule Hildesheim/Holzminden/Göttingen', ...
0
votes
0answers
224 views

Latest of group in subquery is bottleneck, how to optimizing query?

See Original question I'm fetching the activity data for the latest activity for each company as part of a bigger query. I've been using the method provided by ypercube, and it works fine, but I find ...
0
votes
0answers
61 views

Is it possible to group by a fraction of the result set?

I have a database of products with prices. What I'd like to be able to do is figure out 5 different price ranges such that each range, when ordered by price, will have approximately the same number of ...
2
votes
2answers
578 views

MySQL 5.6 showing wrong “second_behind_master”

mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 10.10.7.98 ...
4
votes
1answer
578 views

MySQL - GROUP_CONCAT returns duplicate data, can't use DISTINCT

I have a normalized database and I'm trying to return data from multiple tables using JOINs and GROUP_CONCAT. Problem: Rows are being duplicated with GROUP_CONCAT. I can't use DISTINCT because some ...
0
votes
1answer
13k views

MySQL: split value in column to get multiple rows

I have some data in a table like so: product_id categories 10 9,12 11 8 12 11,18,5 I want a select statement that would produce this output: product_id ...
3
votes
1answer
4k views

What is better in IN()? Sub-query or list of values

If search or update rows and use where statement IN() - is better to select values with sub-query or define values or there is no efficiency difference between this? For example: SELECT a FROM b ...
4
votes
1answer
15k views

Get a fixed value on a select

I need to do a SELECT query where I get the value of the field "money". The field doesn't actually exist in the database. I just need the query to return this field with a fixed value; in this case ...
3
votes
2answers
2k views

Grant access to a table to all users

Is it possible to assign a grant to a table for all users, or a default permission so that when new users are created they will have the specific grants for that table to SELECT, UPDATE, INSERT and ...
3
votes
2answers
234 views

Is it suitable innodb_buffer_pool_size for MySQL Master-Slave

I am wondering how to decide the value of innodb_buffer_pool_size for my Master-Slave style database. I have a set of MySQL, 1 x master + 1 x slave. As I know that the innodb_buffer_pool_size is ...
2
votes
1answer
75 views

Start and Stop entires in MYSQL Logs

I am a newbie to MYSQL and I am trying to check where does MYSQL log start and stop entry with timings. I have issue in my application where I get communication link failure at random intervals and ...
0
votes
1answer
530 views

How should I config the my.ini(or my.cnf) file for mysql?

Thanks for taking your time to look at my question, and I hope that you can help me with this. I have a Windows Server 2012 server, it has: Memory : 3840MB Ram Processor: Intel(R) Xeon(R) CPU ...
0
votes
1answer
863 views

MySQL will not start

Please help, I really need to recover my databases. service mysql start start: Job failed to start mysqld --verbose 140401 20:16:11 [Warning] Can't create test file ...
1
vote
1answer
5k views

MySQL Workbench EER Diagram and ENUM data type

I am creating EER model diagram using MySQL Workbench (version : 5.2.47) The version for MySQL, I am using is 5.5.35-0ubuntu0.13.10.2. I have created a schema with 'Default Collation' set to 'utf8 - ...
7
votes
2answers
18k views

Server requested authentication method unknown to the client [mysql_old_password]

Warning: PDO::__construct(): The server requested authentication method unknown to the client [mysql_old_password] SQLSTATE[HY000] [2054] The server requested authentication method unknown to the ...
0
votes
0answers
454 views

MySQL - Problems caused by SQL Security definer or invoker

I have a view used to be defined as: > **CREATE > ALGORITHM = UNDEFINED > DEFINER = `user1`@`localhost` > SQL SECURITY DEFINER VIEW `schema1`.`view1` AS > select ...
0
votes
1answer
2k views

MySQL returning only 1 row, multiple entries in the database

I am creating a list of all publications for employees, and I am currently stuck on a query. It runs with no syntactical errors, but it only returns one row. The ERD for the relevant tables is as ...
-1
votes
1answer
3k views

Use variables in filename with INTO OUTFILE (timestamped filename)

SELECT * FROM project INTO OUTFILE 'C:\desktop\[timestamped filename like 01/05/2014.csv]'; Can anyone help me out?
1
vote
1answer
10k views

MySQL SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded

I have database session enable, when website got thousands of visitor. It gives me error [30-Apr-2014 04:27:12 America/Denver] PHP Fatal error: Uncaught exception 'PDOException' with message ...
2
votes
2answers
22 views

Cause of delay after use `$database`

For a certain project, it seems like the command use <database>; takes an extraordinarily long time (often a minute or more). (This seems to be the case across a couple of different instances on ...
1
vote
1answer
386 views

RDS MySQL instance is unavailable, probably during binlog rotation

One of my customers uses a few EC2 linuxes with PHP application, connected to a standalone MySQL RDS. He reported application outage. During my investigation I found that this outage happened ...
2
votes
1answer
961 views

InnoDB engine is not loading after tuning parameters

After installing MySQL-5.1.73, I placed default my-huge.cnf into /etc/my.cnf and started the mysql service. It was running without any issue. Now, I tunned some parameters in /etc/my.cnf file. Below ...
1
vote
2answers
749 views

Strange behaviour with MySQL 5.1 TO_DAYS partitioning schema

I have this table definition: CREATE TABLE `va_ventas` ( `ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `Date` DATE NOT NULL, `Time` TIME NULL DEFAULT NULL, `Country` VARCHAR(3) NULL DEFAULT NULL, ...
0
votes
1answer
57 views

Will MySQL redirect a read request to the master after a certain time? [closed]

I can't find what variable controls this or any information about the time limit. Thanks!
2
votes
1answer
65 views

How to calculate the space I need for the indexes?

CREATE TABLE info( home CHAR(10) CHARACTER SET latin1 NOT NULL, id TINYINT UNSIGNED NOT NULL, galaxy TINYINT UNSIGNED NOT NULL, galaxy_pos INT UNSIGNED NOT NULL, events TEXT NOT NULL, UNIQUE ...
-1
votes
1answer
291 views

Why Do I Still Get a Duplicate Entry Error When There is No Duplicate Entry?

I am trying to insert this data into my database: https://docs.google.com/spreadsheet/ccc?key=0AjQflI82acM3dFI1Mk04dWlYSFJtM0hsZ0g4ZlExMWc&usp=sharing I receive the following error: 1062 - ...
1
vote
1answer
178 views

How to find the length of multiple column index in MySQL

Is there a way to find out what is the length in bytes for the unique index (NKU) key created through the following command: CREATE TABLE test_ ( testId bigint(20) NOT NULL, name varchar(75) ...
0
votes
1answer
85 views

what is the best configuration for innodb_flush_log_at_trx_commit?

There are 3 different configuration is available for innodb_flush_log_at_trx_commit innodb_flush_log_at_trx_commit = 0 innodb_flush_log_at_trx_commit = 1 innodb_flush_log_at_trx_commit = 2 Which ...
0
votes
1answer
82 views

How does partitioning and the lack of a primary key affect ON DUPLICATE KEY UPDATE

Consider a table with the following columns: phone BIGINT NOT NULL PRIMARY KEY, name VARCHAR(64), state VARCHAR(64) We would like to partition the table on state, however that would require ...
3
votes
1answer
7k views

Deleting & Reclaiming space from InnoDB table

I have a 700GB InnoDB table which I'm not writing any more data to (only reading). I would like to delete the older data it holds and reclaim that disk space (as I'm running out of it). The delete ...
3
votes
2answers
4k views

MySQL COUNT Query taking too long time to execute

I have below query that takes 7 secs to run SELECT COUNT(*) AS `count` FROM `yuldi`.`businesses` AS `Business` LEFT JOIN `yuldi`.`businesses_categories` AS `BusinessesCategory` ON ...
-1
votes
1answer
343 views

Problem with intersection table

I seem to have came to a problem which I am having trouble solving, possibly because I have misunderstood intersections properly(or perhaps I shouldn't even use intersections for the goal). If we ...
-2
votes
0answers
468 views

How to make make my query run fast? [closed]

How to make this query run faster? Table contains over 2 million rows of data and takes around 30 to 120 seconds to process the query. SELECT INET_NTOA(blocks.startIpNum), ...
-5
votes
1answer
87 views

“general_logs” is not being written [closed]

I wonder why my data inside my "mysql" table "general_log" is not writing more record, stock given the last day was yesterday 04/27/2014. My my.cnf file is as follows: [mysqld] ...
0
votes
1answer
1k views

MySQL (on Windows) general log too large to rotate properly?

First off, I'm not sure if this should go to Server Fault or Database Administrators. It could be a Windows Server 2008R2 problem. But I am asking here first in the chance that someone else running ...
0
votes
2answers
905 views

How to preserve ID generated from a PRIMARY KEY when moving data into a new table?

I have a large table (~4 million rows, ~100 fields) which I need to split into a few smaller tables by type so it doesn't become unmanageable as it grows. Each entry has an ID which is an ...
3
votes
1answer
1k views

Mysql 5.5 InnoDB growing CPU - Going crazy

Good morning, I'm currently facing a problem where CPU usage keeps going up until the server crash. I've tried multiple best practices proposed in this forum and on Percona, reinstalled the server ...
1
vote
2answers
403 views

Nested query efficiency in MySQL

I have a table with several attributes like this: id id2 attribute -------------------------------- 1 100 blue 2 100 red 3 100 green 4 100 white 5 102 blue 6 102 green 7 102 ...
2
votes
1answer
179 views

Moving data from an old table into a newly created table with different field names / number of fields

I've been handed over management of a database, and I have had very little exposure to MySQL (or databases in general) so far. I would like to do two things, both of which are (I expect) fairly ...
3
votes
2answers
2k views

MySQL Full Text search increase relevance for exact matches?

I have a MySQL database of ~10,000 organisation names that I want to be able to search. I would like to use a full text search because this would enable me to find "institute of doobry" by searching ...
0
votes
1answer
1k views

Difference between [mysql] and [mysqld] in MySQL configuration file

There are multiple sections in MySQL configuration file: [mysql] [mysqld] [myisamchk] [mysqld_safe] [mysqlhotcopy] [mysqldump] [client] I found that same variables with different values have ...
1
vote
2answers
8k views

Access denied for user 'root'@'localhost' (using password yes)

I was trying to install MySQL 5.6.15 to my computer and got this error: unable to update security settings. access denied for user 'root'@'localhost' (using password yes) I guess current root ...
0
votes
1answer
81 views

Mysql query in Database

How to get all the tables from database with all values in tables using single query.. I tried using $sql = "SHOW TABLES FROM $dbname"; $result = mysql_query($sql); $arrayCount = 0 while ($row = ...
0
votes
1answer
44 views

Couldn't connect to databasee

I have a dedicated webserver and a dedicated database server Often , i got errors connecting to database server couldn't connect to database Here is my current /etc/my.cnf configuration file ...
1
vote
2answers
126 views

Are relay logs necessary for replication?

I'm trying to understand when/where using relay log is beneficial. According the documentation, mysql captures and writes events from the master's binary log as the result of the I/O thread. Then, the ...
0
votes
0answers
66 views

MySQL production vs. development

I have a production database server which I am using for a live web site. I want an exact copy of this database on a separate server, so I can develop against it. My development will involve ...
0
votes
2answers
699 views

How to change the path of data during database restore + SQL Server 2008

I am trying to restore a big database in SQL Server 2008 R2. The database is about 700GB in size. My SQL Server is installed in C drive which has only 100GB of space left in it. I have the .bak file ...