MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

0
votes
1answer
10 views

Master-master Replication with 3 Nodes

I need to configure mysql master/master replication with 3 nodes. Currently I have master/slave setup and I need to move it to master/master with 3 nodes. I have gone through some posts about ...
3
votes
1answer
211 views

mysql second slave not syncing while first slave works fine

I have a master (m) - slave (s1) setup using mysql 5.1.45 When I try to add a second slave (s2) the slave lags behind and never catches up on the sync. Even after having synced the s2 with the whole ...
0
votes
1answer
11 views

Is it possible to uninsall MySQL-5.6 and install MySQL-5.1 on RHEL 5

I have installed MySQL-5.6.x community edition on RHEL5. It was running fine. Since, it is my testing server. To find the differences in execution timing, I have to install the MySQL-5.1 community ...
0
votes
1answer
12 views

MySQL crashing randomly

We have a sever running a website Joomla 2.5. We are facing frequent mysql crashes that occur when website has medium visitor load like a few thousands. It appears that mysql consumes more memory and ...
0
votes
1answer
224 views

Getting the top count of records from a table for each month and user

I have a table where translations are stored along with the user_id and when the translation was added. I want to create a query that shows the 'Translator of the month' (the person who did the most ...
0
votes
0answers
4 views

add column without metadata lock in mysql 5.6

I am using MySQL Server version: 5.6.15 Homebrew. I need to add new null column. alter table requires no metadata lock. In order to avoid this MySQL 5.6 introduced algorithm=inplace. Here is the ...
0
votes
1answer
19 views

Pulling from Two Tables with Different Number of Records

I have three tables, one for members with 8 records, one for tasks with 1 record, and one for events with 3 records. The tasks table associates the events with members using one-to-many primary to ...
1
vote
1answer
235 views

How to rebuild entire MySQL data after server re install?

I have a MySQL server running with multiple databases in a 32 bit environment. I need to rebuild my system to a 64 bit environment. Is it possible to replicate the entire MySQL databases, users, ...
1
vote
0answers
19 views

Copy from one MySQL table to another MySQL table of same database

I have around 40 million rows in a MySQL table and I want to copy this table to another table in same database. What is the most efficient way of doing this? How much time will it take (approx.)?
0
votes
1answer
40 views

How to prevent crashes connected with dropped tables during mysql import?

I have made a mysql dump with mysqldump, tables are dropped and re-created with DROP TABLE IF EXISTS `users`; CREATE TABLE `users` ( However for a read-intensive database I sometimes get crashes ...
0
votes
1answer
17 views

Adding a constant IF not in an other table

So I have this query. SELECT * FROM `Comment` WHERE `Target` = '".$_GET['pp']."' AND `Id` NOT IN (SELECT `Target` FROM `Delete` WHERE `Type` = 'comment') ORDER ...
1
vote
2answers
274 views

Mysql cluster fast inserts but slow selects

I have a mysql cluster with 3 Data Nodes and one SQL node. Curently I have 1million 1kb records. The inserts are very fast, takes only a few ms. But the selects are very slow >20s. All machines are ...
0
votes
0answers
12 views

query execution time in mysql

I have run the query in mysql which consists of approximately 33million records when i have executed the query select population1 < 200000 from city; it shows like this after execution ...
0
votes
3answers
93 views

How to solve multidimensional data relationship

I'm having a problem, that I could solve programmatically, but for my personal (test) project I'm trying to see if I can fix it in the relational model. Imagine a complex fashion product Pants with ...
0
votes
1answer
11 views

Mysql Select using Alias

I Need to filter the query that have some conditional column as below: SELECT `c`.`fullname` AS `fullname`, IFNULL(`c`.`new_ic`,`c`.`old_ic`) AS `Ic`, `bla`.`loan_no` AS `Loan_No`, ...
0
votes
2answers
66 views

How to select the latest record of each hour in a day

I want to select the latest record of each hour in a given date, based on the datetime column 'reading_on' in my table , what is the best way to do it. I already tried group by HOUR(reading_on) with ...
1
vote
1answer
19 views

Merge a table into an existing one

I know how to JOIN two tables as create a new table out of the results, using CREATE TABLE result_table AS ( SELECT * FROM tableA JOIN tableB ). I forgot to include some columns from the JOIN in the ...
1
vote
1answer
79 views

Best Indexing Strategy for Query with Equality[A], Range[B], Group By[C], AND Order By[count(P)]

I have a poorly performing query: SELECT user_id, count(item_id) as count FROM table items WHERE category = 'magazine' AND created_at > 1384754400 GROUP BY user_id ORDER BY count(item_id) desc ...
1
vote
2answers
110 views

Column suitable for natural key?

I have read many articles now about natural vs surrogate primary keys, and came to the conclusion there is no single best practice. I have a table that will have around 2000 definite unique values, ...
0
votes
2answers
156 views

Hierarchical Structure

Every single user has say, 3 of GROUP_A, 10 GROUP_B's per GROUP_A, and 20 GROUP_C's per GROUP_B. And each of the 20 GROUP_C's involve lots of inserts/deletes... I'm not an expert, but I've done ...
0
votes
1answer
32 views

Find youtube url

Good afternoon, I need a help, through a select have to locate within a column all the urls from youtube 'https://www.youtube.com/watch?v=cod'* N codes, as necessary to generate a txt with these ...
0
votes
0answers
6 views

Get travel_point.address_from and travel_point.address_to when driver_has_book.status is 0, 1 or 2

I'm building a view for get travel_point.address_from and travel_point.address_to when driver_has_book.status is 0, 1 or 2 (basically I'll need another data from related tables). I leave the SQL ...
0
votes
1answer
14 views

Bypassed, Empty Relay Log

We have a simple 1:1 Master-Slave replication configuration. The Master crashed, but we recovered and replication seems fine (confirmed by pt-heartbeat and SHOW SLAVE STATUS) but we've picked up one ...
0
votes
2answers
222 views

How to join two result sets from same table with different conditions on same column?

select * from unit_of_measure; +--------+-----------+--------+------------+--------------+-----------------+-------------+---------------+------------------+ | uom_id | uom_name | symbol | created_by ...
2
votes
1answer
31 views

mysqldump --single-transaction, yet update queries are waiting for the backup

If I use mysqldump --single-transaction, according to the docs it should do flush tables with read lock to get a consistent state and then start a transaction and no writers should be waiting. ...
0
votes
1answer
14 views

change character set in mysql permanently

I want to change following parameters to utf8mb4 so that mysql can store emoji characters and special language characters. but when i try running following statements one by one SET ...
1
vote
1answer
655 views

Extremely slow mySql restores

Please bear with me as I ask this question, which looks similar to questions already on DBA@SE. In the current configuration, we have a server (a Linux quadcore box with 4 GB RAM) - Both the Database ...
0
votes
2answers
32 views

Mysql checksum for master-slave replication returning different values, despite being identical

I've set up a master slave replication in mysql and to make sure that I know if the data starts getting out of sync I created a script that: Locks both databases on both servers. Prints the ...
0
votes
1answer
68 views

Need help to understand how information_schema.TABLES get updated

I created large innodb table mysql> select count(*) from big_data; +----------+ | count(*) | +----------+ | 23822336 | +----------+ checked the stats in informaion_schema.TABLES mysql> ...
1
vote
3answers
74 views

How to remove master role from MySQL server

I have 2 MySQL servers, one is the master and other one is slave, that's all good. The problem I have is that the slave is also set up as a master. I would like to disable or remove the master role ...
1
vote
0answers
10 views

MySQL getting killed by AppArmor

I have copied this link from StackOverflow as it is marked as out of topic there and is waiting to be transfered here. So, here it goes: Occasionally, without any identifiable pattern, MySQL ...
0
votes
2answers
76 views

How to verify data dumps between two MS SQL and MySQL

I'm trying to verify data exported from MSSQL and imported into MySQL is 100% accurate using MD5 hash. On Linux, I'm using md5sum and WinMD5 on Windows. The encoding is the same: UTF8. I tried both ...
0
votes
2answers
167 views

How can I optimize this query and support multiple SKUs?

My current query only can select one SKU at a time. I can leave salesite_id constant. If there is a way to also have varying salesite_ids that would be good too, but not necessary. Also any ...
1
vote
0answers
28 views

call id of a table to a new table and insert values to this new table

I have recently started to write server scripts. Although the question may seem to be very basic but i am not able to get a solution. I have two tables one is PRODUCTS and the other is DEALS. ...
0
votes
0answers
21 views

Creating a registration page with PHP and PDO [migrated]

I need to create a registration page using PHP and PDO, and encrypt the password before storing it on the database table using md5 (adding 2 salts to the password). How can I write the script for ...
0
votes
1answer
73 views

Update table from calculated temporary table

I have two tables, one containing a set of user ID's, vote direction (-1 or 1) and ID of the object they voted on (casted votes table). In the other table, the object id, upvotes, downvotes and ...
1
vote
2answers
399 views

Which one to use? InnoDB Replication or MySQL Cluster?

I am building a url shortener and I use InnoDB as the storage engine for link data. I will start with a single VPS containing both application instance and MySQL database instance on the same Virtual ...
0
votes
2answers
65 views

Check for table corruption

I monitor MySQL databases by querying various things remotely. I recently came across an issue where by a table had become corrupted but I did not know about it until the daily mysqldump failed. Is ...
0
votes
2answers
45 views

Error changing mysql 5.6 default port

I've changed my.ini with port=3308 but after restart the service mysql 5.6 is working in the same default port 3306. I've tried in mysql 5.5 and it worked fine. C:\Archivos de programa\MySQL\MySQL ...
0
votes
1answer
40 views

SQL SELECT - adding field to SELECT with JOIN is changing the results

I have a SQL sentence with JOIN, running on mysql 5.5.16: SELECT DISTINCT (ot.orders_id), ot.value FROM orders_status_history osh INNER JOIN orders_total ot ON ( osh.orders_id = ot.orders_id ) WHERE ...
0
votes
1answer
32 views

Building a query programatically

I have three variables $color, $size and $category. Each oh them can be a specific value or may refer to all entries.I want to fetch all products that are $color = "red", $size = "Medium" and any ...
0
votes
1answer
794 views

Mysql settings for query_cache_min_res_unit

What is the best setting for query_cache_min_res_unit for these results: +-------------------------+-----------+ | Variable_name | Value | +-------------------------+-----------+ | ...
0
votes
2answers
83 views

mysqldump with automatically generated export name

When I do database dumps through MySQL WorkBench it picks a filename for me which is the current date (YYYMMDD). Now, I want to do this in a batch file since I want to make weekly dumps automatically ...
2
votes
1answer
73 views

Does MySQL do UPDATE in place on NOT NULL column?

Assume I have a table like this in MySQL: CREATE TABLE Foo ( Key INT NOT NULL , MyCol INT NOT NULL PRIMARY KEY (Key)) And I execute a statement like this on: UPDATE Foo SET MyCol = 13 WHERE Key = ...
2
votes
1answer
66 views

How do I write a mysql query to combine data from related tables into a single summary?

I'm having trouble defining the data in a query for a chart. I want to summarize data from the first table and combine it with a data summary from the second table. Products - (serial_number, date) ...
0
votes
2answers
91 views

How to autoincrement Prod_id based on Product_Name using trigger in mysql

Product_Details table : (Fields) Prod_id(Primary key), Product_Name, Prefix and Slno(Auto incremented) i need to increment Prod_Id based on the product name field and prefix field (Input will be ...
0
votes
1answer
370 views

Why does max_connections in my.ini not match concurrent connections in Mysql instance config wizard?

MySQL 5.1.x | Windows Server 2003 Can someone please clarify why max_connections in my.ini is much larger than the manual value I specify in the Concurrent Connections Dialogue? For example, if I ...
1
vote
1answer
35 views

A table that consists of multiple FK or creating separate tables for each FK

I have tables called 'books', 'category', 'subcategory', and 'booksCategory'. Each book can have its own category and subcategories. For example, a Sci-Fi book can belong in the 'category' table under ...
3
votes
1answer
5k views

Change existing datadir path

I want to change the datadir path in the my.ini file. The existing datadir path is C:/ProgramData/MySQL/MySQL Server 5.1/Data/ The size of my C: drive is 30 GB and the MySQL data folder is occupying ...
0
votes
1answer
63 views

What is the strategy of query evaluation in DBMS when Limit is used in query?

I have following tables in database post(post_id , user_id , post_text , parsed_text) ; Comment(comment_id , post_id , user_id , comment_text) ; friend(id , user_id , friend_id ) ; group (id , ...