MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

1
vote
2answers
435 views

What is the size of currently-existing tmp tables in innodb?

This is yet another "how to add a column to a gigantic table" question. The table on disk takes 2.5GB, and I have around 10GB of ram I can use. I have a feeling I can crank up the tmptablesize option ...
2
votes
1answer
4k views

Mysql Forcing close of thread 946 user

My mysql box keeping shutting down and up. Below is snippet of the log file. There is quite a number of places I notice this Forcing close of thread 946 user: 130426 12:36:28 [Note] Event Scheduler: ...
6
votes
2answers
3k views

MySQL replication: most important config parameters for performance on slave server?

I'm setting up a mysql master-slave configuration, where slave is located on a much weaker sever. Since, if I understand correctly, slave only works on updates/inserts, what are the most critical ...
4
votes
1answer
2k views

Take individual MySQL database offline

MySQL does not have any SQL commands or internal mechanisms for making an individual database unavailable / offline moving an individual database Thtis being the case, how can you take an ...
0
votes
1answer
769 views

I can't install db-mysql in node.js

When I execute this command: npm install db-mysql, I get the following result. What's the solution to this problem? C:\Users\Mouad>npm install db-mysql npm http GET https: ...
3
votes
1answer
853 views

MySQL specific database configuration file

In MySQL's configuration file I've globally disabled autocommit as so. [mysqld] autocommit=0 I need to turn MySQL's autocommit on for a specific Ruby on Rails database though. It could be for the ...
1
vote
1answer
230 views

Separating tables vs having one table

At the moment I have a table setup that looks somewhat like this: create table tbl_locationcollections ( id int(11) PRIMARY KEY IDENTITY, --(Primary Key), name varchar(100) not null, ...
1
vote
1answer
156 views

xtrabackup backup grants?

I'm using MySQL 5.5 + Opensuse 12.3 . After face an issue with mysqldump (appear be a bug with OpenSuse Mysql distribution) I have looking for others backup solution. I found the xtrabackup from ...
3
votes
1answer
658 views

Get data from two tables with recursive relationships

I have a MySQL 5.1 DB, being used behind a PHP application to track permissions and other items that need to be issued to staff that hold various positions within an org. To track what privileges a ...
1
vote
1answer
439 views

innodb changing row format doesn't decrease table size? [closed]

We're currently using MySQL with innodb and we have some large tables that are compact in row format. When I change the row format to compressed we are still seeing the same size for the table. Anyone ...
1
vote
1answer
728 views

get rank in marks database in mysql [closed]

I have a Student database having one table EXAM. id 1 2 3 4 5 marks 7 10 7 10 9 Question is how to give rank like +------+ | rank | +------+ | 3 | | 1 | | 3 | | 1 | | ...
1
vote
2answers
2k views

how to import mysql system “mysql” database [closed]

This question might be already answered but it's almost impossible to google it. When I perform full backup of mysql server using mysqldump --all-databases then reinstall it from scratch I want to ...
0
votes
1answer
275 views

Maintenance in MYSQL when innodb_file_per_table disabled

I have read your post and I completely understand OPTIMIZE TABLE to perform in an environment where innodb_file_per_table is disabled, does not shrink the global ibdata1 tablespace. But what if I ...
1
vote
1answer
1k views

Database for opening times of locations

I'm designing a database for opening times and created this solution. The specifications of the database which will be a MySQL are, that a location have standard opening times in a week and can ...
4
votes
2answers
239 views

Understanding COUNT() as `count`,

I'm currently learning how to build a site in PHP mysql. However, I seem to fail to understand COUNT() as count and wouldn't mind some further explanation. I get the principles of COUNT, 0 || 1, and ...
6
votes
2answers
346 views

mysql performance / cache configuration enigma [closed]

I have two mysql 5.1 instances (say A, B) hosting the same database schema. If I run (with mysql workbench) the same query on both instances I don't understand why I get very different response times ...
11
votes
2answers
26k views

Is it safe to delete mysql-bin files?

I have MM Replication in mysql, and I want to squeeze some free space in the box be deleting unnecessary files, I came across these mysql-bin files inside /var/db/mysql/ There are hundreds of those ...
1
vote
1answer
631 views

Creating a partial unique constraint for MySQL

I have the same question as asked in a previous post: PostgreSQL multi-column unique constraint and NULL values. But the solution there is not applicable as I am using MySQL instead of PostgreSQL. My ...
6
votes
2answers
975 views

Master-Slave Database. How to activate a secondary database whenever the primary database is down?

I need some idea on how to accomplish a master-slave database in MySQL. It's like, there's a primary server which the system connects then when it is down, it will use its local server. Here's the ...
0
votes
1answer
65 views

mysql replica ignoring server-id [closed]

I've setup a mysql replica slave a couple months ago. After a couple hickups lately, I've decide to restore it from a clean master export. I'm trying to start my mysql instance with this command : ...
1
vote
1answer
4k views

Is it possible for a trigger to update a row in a table using a value that was deleted?

I have a trigger which is updating a column in a different table after the row is inserted: mysql>delimiter $$ mysql> create trigger status after insert on table2 FOR EACH ROW BEGIN ...
2
votes
0answers
145 views

Changing Charset to utf8 for all the fields and tables in mysql

How should I use the mysql and awk to change the charset for all the fields and tables for a specific database? I did not include username or password, so for sure it will not work. Should I run it ...
1
vote
3answers
232 views

Help with modeling this table

Thanks for reading my post...I'm new at setting up databases and am working on a simple practice app. I have a table called PhoneNumbers, which hold a list of phone numbers (duh). I have two other ...
0
votes
1answer
364 views

How can I modify this trigger with loops and concat?

I have this trigger below which inserts new values in the an emplog table. I want to have my trigger insert in the description column the event that took place. For example, if I changed the last_name ...
0
votes
1answer
75 views

best relationship for this design?

There is a table users with autoincrement primary key id. There is also a table employees (every employee is a user but not vice versa). The employees primary key is userid. The field userid is not ...
2
votes
2answers
2k views

MySQL - SQL statement to test minimum length of the word 'ft_min_word_len'

I'm trying to understand FULLTEXT indexes. Is there some SQL query to test 'ft_min_word_len' variable? I've tried to match four characters only in the example below but it doesn't work. Why the ...
0
votes
1answer
26 views

Which of tables key to reference?

MySQL. There is a table users with autoincrement primary key id. There is also a table employees (every employee is a user but not vice versa). The employees primary key is userid. The field userid ...
0
votes
0answers
391 views

XML Data convert to SQL database,

I have an XML feed that i need to parse daily, i want to store all of the data from the XML feed in a SQL table so then that data can be queried and manipulated by my clients. I can currently parse ...
4
votes
2answers
2k views

Index before or after bulk load using load infile?

I have a database with over 1B rows and two columns that are indexed (in addition to the PK). Is it better to have the index pre-defined in the table before the load infile or better to index after ...
2
votes
1answer
42 views

Relational Database tables

I have a table Player where playerID is the primary key. Then I have a table Game where gameDate is the primary key (of type DATETIME). Each game is played by 2 players and each player can play many ...
0
votes
0answers
80 views

MySQL replication is not happening when piping sql into mysql client

Today I noticed a very strange issue where if I cat a SQL file and then pipe it to MySQL client, replication doesn't happen. These MySQL statements aren't also written to the binlog. But replication ...
7
votes
1answer
192 views

Start/Stop MySQL

I'm seeking help to understand what happens when the following command line is executed: root@prodn$ service mysqld stop Yes, it shuts down the MySQL server so access to it is no longer available ...
1
vote
1answer
7k views

MySQL trigger - delete data from multiple tables

I would like to delete data in multiple tables, from a trigger but it seem like my syntax is incorrect. I got the error: "you've got a error in your MySQL syntax please check the manual". This ...
3
votes
2answers
3k views

Live backup without lock

In our company we have a lot of MySQL databases. Some of these are critical and we want to take a back-up of all databases. These databases can't be locked because the application can change these ...
1
vote
1answer
55 views

Is it better to add an index and search via the index or add a unique constraint and let an insert fail?

I have a table with over 2.5 million records in production that keeps track of if a specific user has already viewed an job: mysql> DESCRIBE job_views; ...
2
votes
1answer
2k views

Will OPTIMIZE TABLE have any impact on my data?

I'm having issues with a database that is getting quite slow. The analyzer in phpMyAdmin recommends that I run OPTIMIZE TABLE on my tables. But before doing so, I would (of course) like to know if ...
1
vote
1answer
233 views

mysqldump error on bash script

I'm trying to run a bash script to backup my database with Cronjob. # Backup and compress each database for database in $mysql_databases do if [ "${database}" == "information_schema" ] || [ ...
7
votes
4answers
833 views

How to create a database for unknown kinds of data?

I am in the process of designing a database for a new PHP/MySql-based application. My problem is that I do not and cannot represent what should be saved in the database because it is unlimited and ...
3
votes
1answer
334 views

Switch MySQL lag slave to new master and keep lagging (5.1)

We have the following scenario: Set of slaves replicate from the master, separate standby master (a.k.a slave with binlogs) replicates from the same master; lag slave, powered by pt-slave-delay, ...
1
vote
1answer
31 views

Proper names for SUM(col) fields

I have worked on MySQL databases for a long time, but one question I have never been able to get an answer to that seemed formal is: In the query SELECT *, SUM(col1) FROM tbl, what is the proper name ...
1
vote
2answers
33 views

A query for a latest version of data

MySQL. Let there is a table with fields startdate and kind. Actually in the real problem column named here startdate and kind are in a UNIQUE index, but the case if only startdate (not kind) is ...
1
vote
1answer
31 views

Simple query not using indexes

My query is not using indexes. It is a simple query. Can someone explain why that's the case? The query: select TIME_FORMAT(start_time,'%H:%i') start_time, TIME_FORMAT(end_time,'%H:%i') ...
3
votes
1answer
1k views

MYSQL score by rank

I am using MYSQL to create a rating system to implement my database. What I want to do is to rate each attribute by its percentage. Here is the example database: ID, value 1, 3 2, 5 3, 2 4, 5 The ...
4
votes
1answer
1k views

Simple MySQL query randomly takes forever

I'm having an issue on my server with a simple PHP send emails script that runs every minute via a cronjob. The script contains a MySQL query that runs very fast most of the time, but randomly will ...
3
votes
1answer
328 views

Is it possible to select internal InnoDB columns?

I have read that InnoDB uses a few fields internally for all rows, such as the hidden columns DB_TRX_ID and DB_ROW_ID. Is there any easy way to see these values, such as within a select statement?
2
votes
1answer
774 views

replicate-wild-ignore-table does not stop already logged queries on slave

We have a master DB where where multiple queries where fired on a specific table, these queries were taking too long to execute on slave and it was lagging behind and as a result of which queries were ...
3
votes
2answers
8k views

Restoring a database backup to a local machine in MySQL

I have downloaded my .sql file of my database server. It is in the D: drive of my Windows machine. I want to restore the back up in my this machine. I used: mysql database -u root < ...
1
vote
1answer
983 views

MySQL replication — issue with mysql.proc during replication from 5.0 to 5.5 host

We are replicating from a mysql 5.0.45 host to a 5.5.26 host over WAN. Every once in a while one of our databases does not accept a query and halts the replication. "'Column count of mysql.proc is ...
2
votes
1answer
317 views

High IO when switched to InnoDB

We have query that worked well in MyISAM. When we switched to InnoDB, the writes I/O raised up to 50 times. The query is type of INSERT ... ON DUPLICATE KEY UPDATE I don't know if the problem is ...
3
votes
2answers
8k views

Is there a way to stop MySQL Replication on the master?

I want the master to stop replicating data to the slave. I know I can do that on the slave with STOP SLAVE;, but I wonder if there is a way to do it in the master. One possible solution might be to ...