MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

1
vote
1answer
29 views

Duplicate Same Table for Multiple locations

We have an "appointments" table with following schema. appointments(app_id,.....,app_type,location_id) app_type - type of appointment location_id - keeping the location for multiple location setup. ...
3
votes
1answer
21 views

Mysql suddenly crashing after several months

I'm away on leave and mysql on an EC2 (m3.medium general purpose) based server I have The displeasure of managing has suddenly started crashing. I have very intermittent internet connectivity through ...
3
votes
2answers
24 views

Storing html in mysql text fields, or include files? (html formatted articles)

I'm wondering if I should store long html formatted articles in my MySQL database, or if it would be better to store a reference to a file, and include that instead. It is not just paragraphs, but ...
1
vote
1answer
6 views

set global sql mode but showing a different mode

I have this command to run in my docker file mysql -e "SET GLOBAL sql_mode = 'STRICT_ALL_TABLES';" But when i check the mysql mode it shows as mysql> select @@sql_mode; ...
1
vote
2answers
19 views

MySQL - Small table popping up in slowlog, refuses to use index

So I have two very very small tables (~20 rows) that are hit very frequently and pop up in the slowlog (I'm also logging tables not using indexes). I tested using a large multipart index (that's just ...
1
vote
2answers
38 views

Is it safe to run optimze on mutliple tables in parallel in mysql (percona)

I have a slave on which no query is coming. Lot of data has been archived and deleted from almost all tables. Size of tables vary from 80Gb to few Mbs. And there are around 130 such tables. Mysql ...
0
votes
1answer
57 views

MySQL Trigger Update

How do I update 'emailupdate' date with a trigger when 'email' is updated through a script? +------+----------------+--------------+ | id | email | emailupdate | ...
0
votes
1answer
19 views

MariaDB/InnoDB: Temp file write failure

When attempting to alter a table to enable compression by modifying the KEY_BLOCK_SIZE I received the error: ERROR 1296 (HY000): Got error 64 'Temp file write failure' from InnoDB The command ...
1
vote
0answers
12 views

Why am I getting error 1064 when creating a table?

Here is my DDL statement: create table if not exists 'fmrecruit'.'resource_type'( 'ID' bigint not null auto_increment, 'type' bigint null, 'first_name' varchar(30) not null, 'middle_name' ...
0
votes
0answers
34 views

Same SQL stall on server but work on local ( on slower machine )

I have this strange issue that because of my limited knowledge about Mysql I cannot understand, I will really appreciate if somebody can enlighten me and point me to how to debug the issue. ...
0
votes
3answers
297 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 ...
1
vote
1answer
18 views

Recording history of ranks

Once per day, this is being executed to rank everyone in the database based on points. SET @r=0; UPDATE ranks SET previousRank=rank, rank= @r:= (@r+1) ORDER BY points DESC; The field ...
0
votes
1answer
23 views

Importing MySQL tables from other database in live site with mysqldump can cause trouble?

Scenario: I want to replicate MySQL tables from one database to other database. Possible best solution: May be to use MySQL Replication feature. Current solution on what I'm working as workaround ...
2
votes
1answer
18 views

Storing prices with price history and different specificity (global, user group, single user) in MySQL database

I need to store prices with their history. A price can have different specificity. It can refer to a single user (most specific), group (less specific) and product price (global - least specific). ...
0
votes
3answers
14k views

max_allowed_packet in mySQL

I tried all three method explained here to max_allowed_packet. But no one changes its value in my MySQL 5.6. I use show variables like '%max_allowed_packet%' to see its current value. But it always ...
0
votes
0answers
21 views

MySQL: How to count non-unique rows in a multiple criteria COUNT query?

I want to calculate, in one query, the percentage of researchers (chercheurs) that have co-signed written publications (between two dates, only for a type of publications and only for researchers ...
0
votes
0answers
11 views

Would it be a good idea to create a system using MS Access as a front end and MySQL as a backend? [on hold]

I've recently been working on a MS Access project. I had to re structure the DB as almost nothing was normalized and some issues were encountered. After finishing the DB ...
0
votes
1answer
2k views

Unable to select the records from specific partition in mysql?

I've created a table using the following query, CREATE TABLE employees ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, fname VARCHAR(25) NOT NULL, lname VARCHAR(25) NOT NULL, store_id ...
2
votes
1answer
3k views

Extract MySQL information from a compressed tar.gz file

I have a back up-of a MySQL database which is contained in a .tar.gz file - I need to restore it. I've never had to do this before. The only way I can access the database is through phpmyadmin. There ...
0
votes
0answers
26 views

How come MySQL LIKE is faster then FULLTEXT?

So, I was trying to optimize my MySQL queries, but found out that i'm actually doing this wrong. I've changed my query from using SELECT * FROM test WHERE tst_title LIKE '1%' To: SELECT * FROM ...
1
vote
1answer
102 views

MySQL: Rank by Department in an employees table

I need Mysql query to rank the hours used by each department in an employees table, but it just ranks all without taking into consideration the departments.
22
votes
1answer
37k views

What is the best way to reduce the size of ibdata in mysql?

I have some Production servers whose ibdata files increases in size day by day. It has already consumed 290GB of space. The tables in the servers are mostly InnoDB and there are high read and write ...
0
votes
1answer
106 views

Can't see temp table from subquery

I have a query that selects data from tables and one temp table. This works fine, but there is a GROUP BY/ORDER BY combination that doesn't work well for me. Indeed, I need to order the results and ...
1
vote
0answers
19 views

Table replication with extra TIMESTAMP column on slave

I have a table on master and same table on slave with an extra column like InsertTime timestamp DEFAULT CURRENT_TIMESTAMP I want to keep record of time when there is update on slave. Replication ...
0
votes
1answer
135 views

Is there any relation between BSON storage for mongoDB and MySQL storage?

I am working on an application where I need to make analysis that what will be the storage size of BSON structure if same data is stored which is stored in MySQL. Basically I am comparing MongoDB and ...
1
vote
1answer
372 views

Syncronize mysql databases between local and hosted servers automatically

We have many website with Development , Staging and Production Server. we have many developers for many projects, we need a solution to synchronize the database with developer database with staging ...
0
votes
0answers
21 views

How to implement a query insert into BEFORE INSERT trigger syntax

I want to insert data using trigger into 2 tables. I want to implement my query insert to a before insert trigger. Since I was newbie for using MYSQL, I'm confused how to implement it. insert into ...
1
vote
1answer
3k views

MySQL - ERROR 1045 (28000): Access denied for user : permission issue

ex :on first server : mysql> show grants for 'test'@'localhost'; +---------------------------------------------------+ | Grants for test@localhost | ...
0
votes
1answer
159 views

How to merge two databases, both with primary keys

I have two databases, both with the same tables, but the data is out of sync. I need to add data from database A to database B, but not overwrite any data in B that exists in A, instead add it with a ...
0
votes
1answer
16 views

Creating procedure in mysql [on hold]

I am trying to build a procedure that i would use to check my data format before processing it to the net stop and i need this procedure to check the format of my file. So what i need is, my database ...
0
votes
1answer
503 views

Change MAMP to use a lower Mysql 5.1 version

I need to have the same development environment for my PHP program. My clients test server is running on Mysql 5.1 while my local is using MAMP running Mysql 5.5. How do downgrade my mysql database ...
0
votes
1answer
24 views

How to use MySQLTuner on Amazon RDS

I've installed MySQLTuner locally and it works on my local database. When I try to run it on my Amazon RDS db it does not, it says my login credentials are invalid. $ perl mysqltuner.pl --host ...
-1
votes
0answers
38 views

Create Procedure

CREATE PROCEDURE validateZuoraFormat ( IN client varchar(100)= ' ', IN table varchar(100)= NULL, IN type varchar(100) = NULL, IN debug bit = 0, IN clientReport bit = 0, ...
0
votes
2answers
10k views

How to solve “Can't connect to local MySQL server through socket” error?

I kept getting this following error every time I tried to restart MySql. It was working fine before I changed the default data directory. ERROR 2002 (HY000): Can't connect to local MySQL server ...
4
votes
2answers
189 views

Potential schema for product failures and repairs

I'm creating a schema for product failures and repairs and would appreciate feedback on the schema. The database is intended to capture all product failures and corresponding repairs. A product can ...
0
votes
1answer
547 views

Insert into a view derived from a table with a discriminator field

I am in a situation in which I have a base table with some fields and a discriminator field which could have one out of a specific set of values. From that base table, I have derived many views, one ...
0
votes
1answer
22 views

mysqlbinlog: unknown variable ssl_key or ssl_cert or ssl_ca

I am trying to recover binlog from a remote server using mysqlbinlog client program, however it appears that mysqlbinlog doesn't recognize the SSL options that's required to establish SSL connect to ...
0
votes
1answer
110 views

Lock wait timeout exceeded; try restarting transaction in NDB

I encountered an error while using an opensource product with a mysql cluster. The error stacktrace is shown below. Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting ...
0
votes
1answer
16 views

Are mysql global variables values in bytes?

When I run the following in my mysql terminal mysql> SHOW GLOBAL VARIABLES LIKE 'tmp_table_size'; +----------------+----------+ | Variable_name | Value | +----------------+----------+ | ...
1
vote
1answer
30 views

Binary log backups in MySQL

I'm running a master-master replication with read-only second master. Now since my binary logs are not getting replicated in my passive master. Should I need to enable --log-slave-updates? If I ...
0
votes
2answers
3k views

Optimize IN clause in where query with order by - MySQL

I am trying to optimize a query that using IN clause in WHERE to avoid file sorting. To make it easy , I created the following sample which shows the problem. Here is my query: SELECT * FROM `test` ...
2
votes
1answer
29 views

Which is better MySQL search strategy, varchar x 2 or text column?

I have a MySQL database for an SMS application. For the sms_msg column, I initially setup varchar(255) expecting SMS to be short anyway. Now I realize that's not enough and some messages are getting ...
-4
votes
0answers
19 views

sudo /usr/local/mysqlcluster/scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql-cluster --basedir=/usr/local/mysqlcluster --no-defaults [on hold]

/usr/local/mysqlcluster/scripts/mysql_install_db: 1: /usr/local/mysqlcluster/scripts/mysql_install_db: /usr/local/mysqlcluster/bin/my_print_defaults: not found Installing MySQL system tables... ...
0
votes
1answer
140 views

ubuntu - Pm2 mysql high cpu usage

Not sure what is going on here but would love some help if any can. I am running on digital ocean 1GB ram ubuntu server a node.js application that is is launched with pm2 and that uses a mysql ...
2
votes
2answers
2k views

ERROR 1166 (42000) at line 65203: Incorrect column name ''

I have a big snapshot database size is about 44GB in mydata.sql. When I run it overnight, it show this error message: $ mysql -u root < mydata.sql ERROR 1166 (42000) at line 65203: Incorrect ...
2
votes
1answer
50 views

GROUP BY rewrite to subqueries with easily interchangeable AND OR conditions

Tables: content tag_map extrainfo |id|title| |id|tagid| |id|lat|lng| |--|-----| |--|-----| |--|---|---| |1 |Lorem| |1 |8 | |3 |0,4|0,1| |2 |Ipsum| |2 |9 | ...
1
vote
1answer
40 views

Table does not exist even if there is one

I have MySQL master-slave replication setup in Amazon EC2. For the sake of resilience, I have set up LVM on RAID 10 array, on both master as well as slave. I have been using ec2-consistent-snapshot ...
0
votes
1answer
29 views

MySQL backup practices

I have a MySQL master-master replication with second master in read-only mode. My questions reg backup are: I have 10 databases so should I take daily backup as one dump containing all the ...
1
vote
1answer
234 views

Speeding up a simple select query on Mariadb

I have a 100k rows table with the following structure: +----------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | ...
0
votes
2answers
203 views

MySQL - prevent OS cache for query

On high load production server I have many sql selects which are unique or re-use will be in hours. I use SQL_NO_CACHE but this queries are still cached with OS cache. Server have 64G ram and used ram ...