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
1answer
408 views

what does SHOW /*!50000 GLOBAL */ STATUS do ?

What is the difference between SHOW /*!50000 GLOBAL */ STATUS and SHOW GLOBAL STATUS I saw that in few scripts and tuning presentations the first command is being used. Is there a difference, ...
2
votes
2answers
2k views

Master-Master Replication in MySQL

Good day everyone! I want to clarify something about the behavior of master-master replication in MySQL, with respect to the logs i.e. bin-log and relay-log, it use in performing replication. I ...
2
votes
1answer
214 views

Can not add list partitions

Following is the create table statement that is working as expected. But if I have a table without any partitions and if I try add partitions, it seems that I can not add more than 16 values in it. ...
2
votes
1answer
525 views

Design problem with auto-increment fields

I've made this design similar to my problem, it's not exact but it close enough to understand my problem: http://i42.tinypic.com/bhbp5.jpg Some cellular client frequently send their GPS position and ...
2
votes
1answer
4k views

Repairing Myisam Table when there was no additional Disk space & Table corrupted

I had a table which MyIsam as storage Engine contains million rows. There is a purging task and need to remove 35 days old data. i measured up the rows in following manner : mysql> select ...
2
votes
2answers
3k views

Problem with InnoDB “per table” file sizes

I Have configured the mysql server with innodb per table. There was a table watchdog having approximate 19GB of watchdog.ibd file. I have truncated the table now it has zero record. But the watchdog....
2
votes
2answers
1k views

mysql user creation with % to host , can only log on from remote host

Using MySQL v5.1.52 After creating a mysql user with the following commands: create user 'user1'@'%' identified by 'pass1'; grant select on db1.* to 'user1'; flush privileges; Then doing a 'mysql -...
2
votes
3answers
1k views

MySql shell command not replicated to slave

I have a shell script that looks something like that: #!/bin/bash mysql -udb_user -pdb_password -e "LOAD DATA LOCAL INFILE '/srv/some_file.csv' INTO TABLE db_name.db_table FIELDS TERMINATED BY ','...
2
votes
2answers
646 views

get column from too many tables in mysql

.I have too many tables X1,X2,...Xn (they might exceed 75 tables) in Mysql DB to represent departments of a very large company. every table has structure something like this desc X1; +---------+-----...
2
votes
1answer
171 views

Why cp1256 collation is not 1 byte in MySQL?

I've read an article that cp1256 collation takes 1 byte for Arabic characters, but when I created an index on the column that was cp1256 with type of varchar(900), only 767 characters picked up for ...
2
votes
2answers
435 views

Slow SSD on Dell 710

We recently upgraded our Dell T110 server to a Dell T710 with a 100GB SSD drive. We were hoping that we would see a tremendous improvement in mysql select performance, but unfortunately the new ...
2
votes
5answers
685 views

Help optimizing query in the MySQL slow-query log

Our database is set up so that we have a credentials table that hold multiple different types of credentials (logins and the like). There's also a credential_pairs table that associates some of these ...
2
votes
2answers
204 views

In MySQL, should I add an index even if the query that scans the table is only ran once a month?

Concretely, is it worth it to add an index to a query that scans the table of a mysql database, even if that index would only be used once a month? For example, having a users a table and then ...
2
votes
2answers
1k views

MySQL-NT is crashing frequently

MySQL is crashing frequently and there is no error in the err log file. The following error message was found in the event viewer: faulting application mysqld-nt.exe, version 0.0.0.0, faulting ...
2
votes
1answer
859 views

What are the pro's and con's of using PostgreSQL vs MySQL for binary data?

I read that MySQL has binary safe blobs, but PostgreSQL does not. So far what I've found suggests that "binary safe" is something that really relates to functions and handling of data, not the data ...
2
votes
1answer
942 views

MySQL Master/Slave Master/Master setup?

I currently have 1 mysql server running and want to install 2 seperate mysql VPS'es. Maybe one master for inserts/updates and one slave for selects. What is the best setup for this if I have the ...
2
votes
2answers
184 views

MySQL Query Optimization : Bets and Averages

I have the following selection string: SELECT * , AVG( `q1` ) AS betavg, COUNT( bet_id ) AS nr, MAX( q1 ) AS qmax, (MAX( q1 ) - AVG( `q1` )) AS diff FROM jos_bet_1x3_best GROUP BY `bet_id` HAVING ( ...
2
votes
3answers
6k views

MySQL Slave lag in SHOW SLAVE STATUS does not match SHOW PROCESSLIST

I'm trying to figure out why the reporting of slave lag is different in SHOW SLAVE STATUS and SHOW PROCESSLIST, in MySQL 5.5.13. The only difference to other slaves of this master is that it is ...
2
votes
1answer
132 views

MySQL user account 'From Host' setting

I've just installed Wamp server 2 and I get the following 4 default MySQL users: USER FROM HOST <anonymous> localhost root localhost root 127.0.0.1 ...
2
votes
1answer
10k views

store result set in temporary table, variable or separate variables within a trigger

I'm in the process of creating some triggers to store the the average rating for a given product on the product table. I've also been asked to store the total number of reviews for the product. So - I ...
2
votes
2answers
3k views

MySQL won't start after upgrading to PHP 5.3

Just upgraded to PHP 5.3 with the latest version of mysql, but now mysql won't start. Below is mysqld.log 110516 22:24:46 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 110516 ...
2
votes
2answers
748 views

How to get a user's friends' names?

I have a users table and friends table. The user with ID 1 has 4 friends (with IDs 2,3,4,13). I want to get names and surnames of users 2,3,4 and 13. I can to it with standard queries but it will slow ...
2
votes
4answers
825 views

Best way to automate running several MySQL commands

We have several core db tables on our system and allow our employees access to these tables via views that just show them the data they need to see. We created these views in a new db specific to ...
2
votes
1answer
519 views

Concurrent INSERTs in XtraDB (InnoDB)

I'm currently unable to insert rows concurrently in an XtraDB table on Percona Server 5.1.54. I had the same problem with a similar version of MySQL. My table definition is as follows. CREATE TABLE `...
2
votes
1answer
3k views

What is the corresponding MySQL TimeStamp in MS SQL Server?

I need a timestamp to be created automatically when I insert information in a table. mySQL has TimeStamp but MS SQL Server TimeStamp doesn’t correspond mySQL. Is there any other way around?
2
votes
1answer
23 views

Out of range errors while with insert statements

I'm having an issue regarding every third insert line of the database I'm trying to create. Some background, I have a huge .JSON file and used software (sqlizer) to turn it into input statements, ...
2
votes
2answers
89 views

Will hacking away ibdata1 destroy databases with only MyISAM tables?

I made a mistake. I have a huge database of MyISAM tables that I was playing with converting [a copy of] to InnoDB. I didn't set innodb_file_per_table=1 before doing so. I know that safely shrinking ...
2
votes
2answers
54 views

Importing from CSV file, is crashing mysql server

I am facing a problem with importing large data into single mysql table. Basically I assume it is happening because limited machine resources but, I am having troubles to proof it. this is my CSV ...
2
votes
2answers
50 views

which time period covers date string over datetime column

My question is a restlessness I been having for a time. So, here it goes: If I have a datetime column and perform a date search without the time 'yyyy-mm-dd' in a between statement. Which period of ...
2
votes
2answers
60 views

Migrate SQL Server backup to MySQL for a Wordpress site

I have a client with an old .Net site that used SQL Server. For lots of reasons they decided to switch to Wordpress. They had a bunch of news articles on that old site that they want turned into posts ...
2
votes
1answer
75 views

MySQL running delete trigger on truncate

I have a table that has an on delete trigger that updates another table. THe table I'm trying to truncate has 130,000 rows. I have duplicate schema and data on my dev server as well as the client's ...
2
votes
3answers
112 views

Poor performance of JOIN, WHERE, ORDER BY combination (MySQL)

Goal: select 10 most recent rows from posts which are related to a specific user. There are two tables: posts (~5,000,000 rows) and relations (~8,000 rows). posts columns: --------------------------...
2
votes
1answer
72 views

Unique key based on many-to-many pivot table

I have to manage artists and albums tables: | artists | | albums | | album_artist | +--------------+ +--------------+ +--------------+ | id | | id | | id ...
2
votes
1answer
64 views

Filter rows on data saved as JSON arrays

My data is saved as _________________________________ id | category | other data etc -------------------------------- 1 | ["2","3"] |bla bla -------------------------------- 2 | ["254","34"]|...
2
votes
1answer
63 views

Hybrid Synchronous / Asynchronous Replication?

We have a situation where we would like to have synchronous replication in our main data center, but replicate asynchronously to another region. Our second data center is 3,000 miles away (Site B) and ...
2
votes
1answer
52 views

Multiple tables entry with current timestamp

I have several different tables that the user can perform an action on, for example: Vote Comment Chat Each of the above tables will have a timestamp column, to hold the date of creation (it is ...
2
votes
1answer
50 views

Is it normal that our Wordpress' database crashed multiple times in this month alone?

I just started a new job at a small magazine as an IT guy. It all worked fine, but I'm worried about some issues with our VPS installation. Since I started working here (26 days ago), our Wordpress' ...
2
votes
3answers
89 views

Integer ID vs varchar ID with JOIN

I have a table of users but I don't know what is the best practice between using a unique MEDIUMINT identifier or a unique pseudonyme identifier using VARCHAR. With MEDIUMINT identifiers, like the ...
2
votes
2answers
178 views

How to optimize query on MYSQL with multiple group by clause

I have a web application where users can view data of performance. There will be around 200 to 250 users. Each user will have like 100,000 rows of data per day. It is only table and here is ...
2
votes
1answer
30 views

Taking load off the Master server by using a slave

My gameserver utilizes a Master and a slave on one server. The reason I am wanting to use a slave is because I want to beable to run select queries (read only) to get data without affecting the Master ...
2
votes
2answers
132 views

How to get data from three different tables

This question is continuing of this issue: How to get data from two different tables? Now I need to connect the table Sessions with 2 tables: Input Downloads When I use this query with real ...
2
votes
3answers
54 views

Record inheritance in mySQL

I have been struggling with this for a little while. I want to have a set of calendar records. The top level will apply to a large group; the next level will apply to a sub-set and the final level ...
2
votes
2answers
87 views

Idempotent user and database creation script with MySQL

I have written a shell script which creates a database and user on a MySQL server. The user and database are to be used by a web application and generally this task only be performed once per website ...
2
votes
1answer
56 views

I need help with a SQL-query that results in an error

I get the following error when I try to delete a record in the user table that has an entry in the feedback table: e.g. when a record in the feedback table has a reference to the user table ...
2
votes
2answers
71 views

Optimizing a MySQL “IN” query

I'm trying to optimize a MySQL table for a query of the form: SELECT Col1, Col2 FROM MyTable WHERE Col3 IN('Val1','Val2','Val3',...) I've added an index to the table: ALTER MyTable ADD INDEX(`COL3`...
2
votes
1answer
50 views

Is DETERMINISTIC NO SQL function which returns the same value always a good alternative for using as a constant in MySQL?

MySQL does not support declaring constants which can be used between many stored procedures. For me, it seems that a deterministic no sql function can be used as an alternative for a constant. Example:...
2
votes
2answers
60 views

Mysql hand machine due to high load average and CPU

Mysql is used by only one application which only fire query periodically. When i restart server,It run smooth for period of time. and then crash the whole server. My my.cnf file [mysqld] datadir=/...
2
votes
3answers
82 views

How can I query for a sequence of values in a table

I have a daily record of consumption for every day of a year i.e. 365 records. I am looking for 10 consecutive zeros in the above - i.e. 10 days in a row where consumption is zero. I just need to ...
2
votes
1answer
211 views

Corrupt InnoDB: Start mysqld only innodb_force_recovery=6

I am working with version 10.0.19-MariaDB-1~trusty-log and I'm only able to restart mysqld with innodb_force_recovery=6 and I don't know why. The output of the /usr/sbin/mysqld is the following: ...
2
votes
2answers
23 views

Import MySQL table from a textfile to a remote host with compression

I can import data.sql onto my foreign host with this command: mysql -u username -p -h foreign-host.example.org -A DATA-BASE-NAME < data.sql Which works fine for small export files, but I cannot ...