MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

0
votes
0answers
11 views

Conditionally updating the columns PHP/MySQL [migrated]

I have embedded the MySQL statements in PHP code. Following is my code: $sql1="UPDATE labdata1 SET Date='$d1' WHERE SL=1"; I want to set the column "Date" to null after 48 hours. What I tried is ...
0
votes
2answers
68 views

Very high load avg for MySQL database [closed]

I have a backend server which response to my clients app, it has more than 20k~25k hit per second and this make my server load average very high, I believe that my MySQL config is not appropriate. In ...
1
vote
0answers
30 views

ORA-00937 when calculating a sub-value in an aggregate select statement

The problem described below applies to Oracle 11g databases. I also tested the statements on MySQL and PostgreSQL with no problems of the kind mentioned in this question. I want to use an ...
1
vote
1answer
22 views

SQL : get rows from two tables relatively

I've two tables named categories and products. Simple structure is given below. categories cat_id cat_name 1 c1 2 c2 3 c3 products prod_id ...
0
votes
1answer
30 views

Amazon RDS freezes on mysqldump

My questions is quite similar to Mysqldump from the Amazon RDS. I have the same behavior. Everytime when I do a backup using mysqldump my entire RDS freezes and hence my application is not responding. ...
1
vote
1answer
48 views

First date in a week, not exceed from the month, start from specific day

I want to get first date of week from date, but not exceed from first date of month. This is the query i've tried : SET @date:='2014-10-03'; SELECT IF(DATE_ADD(@date, INTERVAL(1-DAYOFWEEK(@date)) ...
0
votes
1answer
22 views

How to use mysql live update on a mysql table between localhost and remote server?

I have mysql table created/modifying in localhost, and I need to update those in my remote database. I have gone through lot of post regarding this scenario and I found out that I need to use mysql ...
0
votes
1answer
29 views

Select Information from All Tables [closed]

EER Diagram Question List the customer number, customer name (first and last), order number, order date, employee number, employee name (first and last), product number, product name, and order ...
0
votes
2answers
41 views

Determine last time a mysql table was accessed (i.e. SELECT'ed)

In my mysql DB schema there are old tables that are no longer used. I want to come up with a systematic way to show my developer a list of tables and last time they were read (SELECT'ed, not ...
1
vote
1answer
41 views

How can I determine the average number of transactions per second in MySQL?

I'd like to see how many transactions per second an instance of MySQL server is processing, on average (per hour and per day). Is there some query to determine this? I've looked through ...
0
votes
0answers
48 views

Connection to Amazon RDS MySQL instance fails with `init_connect command failed`

I'm attempting to open a connection from my Amazon RDS instance to my local dev machine. I added my IP to the security policy in Amazon's panel (read: whitelisted myself in the firewall) and added my ...
0
votes
1answer
25 views

What is the meaning of “available RAM” for calculating MySQL max_connections

The question was asked previously, "how do I calculate MySQL max_connections" and this was the answer: max_connections = (Available RAM - Global Buffers) / Thread Buffers Since I don't have ...
0
votes
0answers
17 views

is there any limit of MySQL status variable value?

As we know MySQL status variable is a counter variable since the service start. MySQL service in my DB server restart every week (on sunday). Below is my observation since last few week: Suddenly ...
1
vote
1answer
15 views

MYSQL Database PIVOT and wants in specific format

I have below table and its data in mysql CREATE TABLE `pointhistory` ( `id` bigint(20) NOT NULL auto_increment, `channelid` varchar(64) NOT NULL, `deviceid` varchar(64) NOT NULL, `pointid` ...
0
votes
0answers
35 views

Create separate temporary table/view and variables for every query

How can I create something similar to VIEW or TEMPORARY TABLE for every query separately? I have 1 process, it creates and holds one connection (doesn't destroy connection after request, so doesn't ...
1
vote
0answers
25 views

MySQL permissions or privileges (User does not have access to metadata required)

I am using MySQL and I need to give one user to web service for access database. The web service need all permission related to stored procedure, like procedure execution. I executed the following ...
2
votes
1answer
46 views

MySQL Security - Storing lots of sensitive phone numbers securely?

Imagine a table in a database in MySQL that holds millions of telephone and cellphone numbers that relate to itemized billing for VoIP and Cellular carriers. All of these numbers are in VARCHAR ...
1
vote
1answer
31 views

I broke replication. Could this have been fixed?

I ran mysql_upgrade on both my master and slave after upgrading to a later version of mysql. Somewhere during this process replication broke for the mysql table. I was able to fix it manually, but ...
1
vote
1answer
24 views

Shrinking VARCHAR with MODIFY: data alignment and potential for data loss

I'm using MODIFY to change (shrink) a number of VARCHAR fields of various lengths in various tables. In each case, the field is called ip and is a textual representation of an IPv4 or IPv6 address. To ...
1
vote
1answer
19 views

How to conditionally raise an error in MySQL without stored procedure

I need to conditionally raise an error, but I can only use a simple statement and no stored procedure. I'd like to do something like this: select case when foo = "bar" then 1 else SIGNAL SQLSTATE ...
0
votes
1answer
23 views

Transfer relational data from one DB to another production DB currently populated with data - MySQL

Details So, unfortunately, at work the other day we put a site into production after some editing/changes that still had the development database configuration. As a result, we have several records ...
1
vote
2answers
60 views

Help in designing mysql table for large project

I am planning to create a website which allows different Companies to register in it. It will have Employees module. Each company will have a CompanyId. How do I maintain the Employees table, since in ...
1
vote
1answer
33 views

How to take physical backup of MYSQL database

I am trying to find out some tool which can take physical backup of MYSQL database. Like mysqlbackup but it is not open source. There is mysqldump but i want to take physical backup. Can someone ...
0
votes
1answer
19 views

ibdata1 recovery mysql failed

I have hosted the Digital Ocean one mysql host with the configuration of 60GB of HD and 4GB of RAM. Some days the database stopped accepting new connections then started a investigation and found that ...
0
votes
0answers
23 views

Two types of rows with mutual fields and unique fields

I have a question about DB design. (MySQL) In my website, users can leave reviews for Stores and Products. Right now, there's a table for stores and a table for products. Each item ('item' = either ...
0
votes
1answer
22 views

MySQL: What do we mean by 0 value in in_use column of show open tables statement?

If I run show open tables command, system return 73 records. But, in_use column value for every record is 0. What does this mean? Are these tables available in cache but not used by any thread?
-1
votes
1answer
16 views

alternative foreign key syntax

in mysql you can assign primary key constraint to a column using two different syntax: after the column is defined, separated by coma, optionally in a new line id int auto_increment, primary key(id) ...
1
vote
1answer
30 views

MySQL replication duplicate key errors after error 1594

So I had this happen to me recently: mysql> show slave status\G; *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event ...
1
vote
1answer
22 views

How to cache query for re-use in following UNION of queries?

I need to perform query, save the result and re-use it multiple times in one session (something like WITH in Oracle DB). This is the query I want to save: SELECT `event`.id, event.name FROM ...
0
votes
1answer
26 views

How to setup large database access/cache on LAMP environment? [closed]

My application is getting very slow I guess because of the ever growing database (30+ tables some with 50,000+ rows). Using CodeIgniter's model tier to call MySQL database, I optimized queries & ...
1
vote
1answer
28 views

How can I speed up this simple query

I am trying to speed a query that grabs data to be used to display a graph for a research project. It's currently VERY slow. It has 18295603 items only and takes about 20s per query. Here is an ...
1
vote
1answer
42 views

MySQL: IF statement check is a table exists

I run in the following issue and can't figure out how to resolve it. delimiter # create procedure pr1() begin declare v1 double default 0; start transaction; ...
0
votes
2answers
29 views

Create table on a Master - Master config avoiding replication

I have a Master-Master configuration. What I want is to create an auxiliary table only for a report project so it's not necessary to replicate it. Is there a specific way to make this in the CREATE ...
0
votes
0answers
5 views

ODBC/MYSQL Insert a Query Result from ODBC to a databse in MYSQL [migrated]

I'm connecting to a cloud database through a ODBC connection: $conn=odbc_connect('MYDATABASE','',''); if (!$conn) { exit("Connection Failed: " . $conn); } $sql="SELECT DATETIME_ID, NAME, Sum(CNDROP) ...
0
votes
0answers
15 views

MySQL - Checksum won't match between master and slave hosts despite dumping and reloading the table [duplicate]

I am playing around with table checksums and I am puzzled as to why I cannot get two checksums to match. I have two hosts, one being a slave for replication. I have a particular problem table that ...
0
votes
1answer
32 views

Log all table updates for all tables in MySQL

Is there anyway I can get the last updated time of a set of tables? By last updated time, I mean not only when the table's schema changed but when any of the rows changed or even when rows were ...
0
votes
1answer
56 views

Mysql 5.5.38 ERROR 1062 (23000): Duplicate entry '' for key 'anykey'

I dropped my UNIQUE KEY index 'myindex' on a table and I wanted to change the UNIQUE KEY to something else, so after dropping it I did: alter table mytable add unique key anykey (add1, city, state); ...
0
votes
0answers
11 views

Setting the Relationship as a Continuous Line Without Changing the Qty INT into Primery Key on SQL

Now it is required to make the following database. In the following, if I tick the checkbox of "Identifying Relationship", the line will become continuous line but the key type will also be ...
0
votes
1answer
52 views

sql or hql query to find all parents of a particular record

I need a sql or hql query to find all parents of a particular record, that should work in oracle as well as mysql, for eg if I have the id: 201, the parents would be: 188, 187, 1. any help would ...
2
votes
1answer
38 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 ...
1
vote
1answer
29 views

Deciding which MySQL execution plan is better

Background: I have a query that I'm trying to speed up, involving 3 tables: omgenvelope has 5 million rows omgcust has 195 rows omginput has 35836 rows I'm obtaining the distinct omginputs ...
0
votes
0answers
27 views

mysql advanced query

I'm sorry for my English. I have a problem with db mysql. I have a table like this id|rat|time 1 |2 |12:00 2 |0 |12:55 3 |0 |13:05 4 |6 |13:45 5 |0 |14:00 6 |8 |15:00 7 |0 |16:30 8 |9 |17:00 ...
0
votes
1answer
31 views

How do I organize tables for simple lottery game? mysql [closed]

I am building a simple lottery web game that will let users pick a number that is in between that weeks given range. A number will be randomly select to determine the winner. I have a table for users ...
0
votes
1answer
24 views

Is it possible to modify an existing trigger definition in MySQL?

I am wondering if it is possible to update a trigger definition in MySQL. For example, I have a trigger T and I want to add some new functionality to it. My assumption is that I need to drop and ...
0
votes
0answers
22 views

How to handle too many instances of multiple tables?

If there is a table accessed by multiple DB threads ( for example 100) at a time then how many instances of that table will be opened? If I run show open tables and see that in_use column value of a ...
1
vote
2answers
44 views

How to swap roles of Master-Master?

I've just taken over the responsibility of managing our MySQL databases. We're running Percona Server (GPL), Release rel24.1, Revision 217. Our setup involves two servers both running as master and ...
0
votes
1answer
29 views

Why does my MySql Savel replicate changes that are neither in binlog_do_db nor replicate_do_db?

I have a standard simple master slave replication that usually runs fine. But sometimes, all of a sudden, I get replication errors on the "phpmyadmin" table. I have explicitly only specified one ...
0
votes
0answers
25 views

MySQL check if user has the required privileges before execute CREATE query

I'm working on a get started wizard in my application, and I've come to the part where the user needs to create tables in order to proceed. That can be done in two ways; either copy/paste the provided ...
2
votes
0answers
33 views

Mysql search matching multiple values in multiple columns

I need to speed up a search. Currently we let our users input a name: John Doe Then in Java we split that string to create multiple values (or "terms") ["John", "Doe"] and loop through the terms ...
0
votes
1answer
54 views

MySQL uses more than 500% of the CPU

Everything was going fine, but since a couple of hours ago MySQL is using from 400% to 550% of the CPU. I'm getting a lot of these errors: 1003 14:03:17 [ERROR] /usr/sbin/mysqld: Incorrect key file ...