MySQL : Open-Source, Relational Database Management System

learn more… | top users | synonyms

1
vote
2answers
116 views

How can I improve this query

I have the following table: CREATE TABLE `twitter_relationships` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `source_twitter_id` bigint(20) NOT NULL, ...
0
votes
1answer
37 views

Mysql database connector table or keys

This may be a simple a question but I just wanted to clarify, at work I have a table containing a list of titles and I also have a list of authors in two different tables. What would be best way to ...
1
vote
1answer
248 views

Can't start MySQL after creating new slave from innobackupex [closed]

I am setting up a new MySQL Slave and I can't start mysql after replacing the datadir (/db/mysql) with the innobackupex backup from the master. I have given the directory the permissions with: sudo ...
1
vote
0answers
783 views

MySQL: Writing log entries from stored procedure

Is there a standard way to write log messages in MySQL stored procedures? I can write log messages to a designated log table, but I prefer the standard log mechanism where each message is coupled ...
2
votes
1answer
262 views

How to solve the error “Error 'Got error 0 'No error' from NDBCLUSTER' on query”?

I'm currently working with a large network of MySQL 5.1 DBs (using MyISAM tables) and I'm evaluating a move to MySQL Cluster. I would like to have the MySQL Cluster replicate off of one of the ...
0
votes
2answers
209 views

MySQL: SELECT the n-th item from an ordered result

SELECTing the top n elements from a table is easy: SELECT id FROM pixels WHERE pixel_id='some_pixel_id' ORDER BY id DESC LIMIT 1000; Finding the n-th element with a subquery is quite ...
6
votes
1answer
2k views

MySQL table creation insanely slow

A simple table creation on one of my MySQL databases takes forever: mysql> CREATE TABLE blah (id BIGINT UNSIGNED NOT NULL PRIMARY KEY); Query OK, 0 rows affected (16.58 sec) The machine is quite ...
0
votes
1answer
48 views

How to summarize Bridge results?

I am trying to summarize Bridge results for each pair (north/south pair and east/west pair). Match points for pair north/south is MPNS, for pair east/west is MPEW. Is there a way to summarize all ...
2
votes
1answer
142 views

Rank in more tournaments and boards

Source data is of sample tournamet board player score 1 1 2 990 1 1 4 980 1 1 6 480 1 1 7 450 1 1 9 980 ...
9
votes
4answers
6k views

Adding an index very slow…is there a mysql cmd to get an ETA or show progress?

I'm currently running an alter query on my table (20M entries) in order to add an index. it's running for more than 3 days already (stuck on 'copy to tmp table'). is there a way I can see the ...
0
votes
3answers
132 views

Joining two tables and query them

I want to select the name and date of birth of all living artists who have value more than 50. My tables are artist and picture and I wrote this SQL statement but it is not giving me the desired ...
2
votes
3answers
231 views

MySQL data view

I have a table that looks like this: +----------------------------------------+ |Name | kode | jum | +----------------------------------------+ | aman |kode1 ...
1
vote
2answers
148 views

How to remove tables and indexes?

I've a file with the SQL statements to create tables, indexes, etc, and another file with data test to use in the test database. Then, I want that they can be removed. How to remove table and indexes ...
7
votes
7answers
2k views

MySQL Indexing VarChar

I am trying to index my blogentries database for better performance but found an issue. Here is the structure: CREATE TABLE IF NOT EXISTS `blogentries` ( `id_id` int(11) NOT NULL AUTO_INCREMENT, ...
1
vote
1answer
54 views

Query from database

I have a table named mip. The table has primary key id, a foreign key product_id and a column usage_type. product_id is a primary key id to a table named product. It is one to many relationship from ...
1
vote
0answers
119 views

What would make a MySQL database create tables in a different collation other than its default?

I am adding tables to a Wordpress database on my localhost and it is changing my collation from utf8_general_ci to latin1_swedish_ci. I'm kinda stumped because I'm not familiar with working directly ...
3
votes
1answer
213 views

mysqld-multi with first DB as Slave and second DB as Master

Yesterday, I setup mysqld-multi in my.cnf. It works fantastic, but there is still a further Problem. The first DB on socket 1 running as Slave from a other server. The second one from socket 2 ...
4
votes
1answer
371 views

Hierarchical queries without CTEs

I'm new to MySQL. The GetFamilyTree(id) function that Rolando suggested in the Find highest level of a hierarchical field: with vs without CTEs question was great but when the id is greater than 999 ...
2
votes
1answer
2k views

Suggest a MySQL book for me [closed]

I have recently joined a team in my corp office that has mysql as a part of their work profile. Though the mysql work not often in this team, but when they do it comes in big scale. The main mysql ...
10
votes
1answer
10k views

How is INFORMATION_SCHEMA implemented in MySQL?

The INFORMATION_SCHEMA is, in theory, a set of views specified in the SQL standard that allow the user to inspect the system's metadata. How is it this implemented in MySQL? When I connect to a fresh ...
1
vote
1answer
199 views

Unit testing with InnoDB transactions

So, I'm running some unit tests against some InnoDB tables in MySQL. Each unit test is wrapped in a transaction: setUp: SET autocommit = 0; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; ...
2
votes
1answer
107 views

mysql read slave to fetch entire database on start

I am building a standart infrastructure, where writes are going to master db, and reads are going to slave dbs. The idea is that when I need more read power - I just spawn more MySQL slave servers. ...
4
votes
3answers
2k views

AWS RDS MYSQL How do I reduce the DB size? [duplicate]

Possible Duplicate: How do I reduce the database size on AWS RDS MySQL? I have a mysql DB on Amazon. It is bigger than I need and I don't want to pay so much. Q: How do I make it smaller? ...
2
votes
1answer
418 views

Recovering from a stuck query

I have a big DELETE query (deleting 20M rows from a 600M row table with condition according to indexed column) that is stuck - running already for 17hrs. Because it's an InnoDB table, killing it will ...
0
votes
1answer
369 views

SQL DB design to support user feeds (in application like facebook)

I have a social network server with a MySql DB. I want to show the users feeds like done in Facebook. Example - UserX now Friend with userY, userX did like on postX etc. Currently I have table: C1 : ...
1
vote
1answer
6k views

Problem with View When Restoring a MySQL Backup

I have a database (InnoDB) with some tables, views and routines... Periodically I do a backup using the command line: mysqldump -u user -ppassword --routines db_name > backup.sql But I have a ...
2
votes
2answers
662 views

MySQL corruption even after full dump and re-import

We have a production issue where MySQL has started spitting InnoDB corrupt page errors and falling over. The error message seem to relate to indexes so I assume the data itself is ok and when I ...
2
votes
2answers
950 views

How to enable all the possible backup options of MySQL

I normally use MySQL Administrator to backup my database. I want to enable all the backup options for the available backup types in MySQL. I noticed that Binary Logging is not running on my PC. How to ...
1
vote
1answer
152 views

Does MySQL compress the stored data?

When I export a database in MySQL, it gives me a .sql file. Let's say this .sql file is 80 MB. Are they compressed in order to reduce disk space usage? Is that 80MB real physical-storage size?
4
votes
1answer
1k views

What's the fastest way to replicate a MySQL database from one machine to another?

What's the fastest way to replicate a MySQL database from one machine to another? The two machines are connected via LAN. How to do it without mysqldump? If using mysqldump, is the fastest way $ ...
5
votes
3answers
8k views

How to convert a MySQL database to PostgreSQL?

Is there any command line tool for converting the MySQL database to PostgreSQL? I'd also like to know if there is a way to convert the database using the normal mysqldump command.
1
vote
1answer
586 views

How mysqldump replaces special characters during dumping records?

i am trying to dump a particular row using java. So that i retrieve the data by using record sets and i manually written sql script code by appending the dynamic records. But my problem is i could ...
2
votes
2answers
474 views

mysqldump reimport isnt working correct

I am trying to restore this database with my sql file I have...yet just get this output with it not importing anything into my db. Thoughts? [root@domU-12-31-39-0B-06-AA data]# mysqldump ...
19
votes
2answers
23k views

When to use views in MySQL?

When creating tables from multiple joins for use in analysis, when is it preferred to use views versus creating a new table? One reason that I would prefer to use views is that the database schema ...
1
vote
2answers
1k views

remove almost duplicates based on insert time

Have a MySql table that records magnetic stripe swipe times from identity cards: CREATE TABLE `swipes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `personalid` varchar(20) NOT NULL, `swipe_time` ...
2
votes
1answer
9k views

mysqldump: Error: 'Can't create/write to file

Can't create temporary files on /var/tmp. mysqldump: Error: 'Can't create/write to file '/var/tmp/mysql.k6NKGk/#sql_5dc_2.MAI' (Errcode: 2)' when trying to dump tablespaces On my OS. id mysql ...
1
vote
1answer
1k views

How to restore a MySQL file to SQL Server 2008

I have a MySQL file (apple.sql) that I need to restore to a SQL server 2008 database or at least be able to access the database through mySQL. I have created a linked server mySQL, created an empty ...
1
vote
1answer
3k views

MySQL: how to optimize the stored procedure?

MySQL 5.5.28 Running pt-query-digest on a slow query log, I get something like this: # 1.2s user time, 10ms system time, 22.30M rss, 114.48M vsz # Current date: Wed Oct 24 23:44:05 2012 # ...
0
votes
1answer
313 views

how to pass url value to index [closed]

How to read the value from URL and compare with index that i have created in MYSQL table. I have a form where provide list of selection using drop down list and i pass the selected value to the next ...
11
votes
5answers
23k views

MySQL server has gone away obstructing import of large dumps

I am trying to import a large sql dump (2GB) to my local mysql on my mac. I have been able to do this in the past (I was using MAMP), but now I get a ERROR 2006 (HY000) at line 7758: MySQL server ...
2
votes
2answers
4k views

The best MySQL configuration for my server

I'm little newbie in configuring mysql and I need some advices. Few days ago I made little home server on Ubuntu Server 12.04 with samba, mysql 5.5, apache 2.2, PHP 5.4.6 etc. I'm using it to ...
1
vote
1answer
168 views

MySQL Cluster Steps To Recover Data If Catstrophic Failure Occurs

I want to know if a catstrophic failure occurs (like a power outage), and all nodes in MySQL Cluster are shutdown in cluster then data will be lost even though a backup was taken? Or it possible that ...
2
votes
1answer
567 views

3 Databases, Best Replication Setup?

We have 3 DB servers, two of them i.e. db1, db2, are located in the same data center. The other one i.e. drdb, is located in a different site. Currently, the replication setup for these servers is of ...
2
votes
2answers
349 views

Does MySQL have information_schema.VIEW_COLUMN_USAGE or an equivalent?

SQL Server has a an information_schema view, 'VIEW_COLUMN_USAGE', which you can use to determine the actual/base tables that the columns in a view reside in. I'm looking for the equivalent in MySQL - ...
5
votes
2answers
668 views

Fetch the newest row grouped by a column in MySQL

My problem seems like it should have a much simpler solution than what I have come up with. Starting with this data set: log_table +--------+-----------+------------------+---------+ | log_id | ...
2
votes
1answer
621 views

Populating an empty table using loops, conditionals, and accessing multiple tables

This question pertains to a MySQL database, although, in the end, this may be database neutral. I am trying to populate an empty table (let's call it NewTable) that I created. The data population is ...
1
vote
1answer
213 views

MySql - selecting into file and re-loading it with special characters

I have a MySql table called twitter_statuses which as the title suggests holds twitter statuses. here is the table structure. this table contains all sort of characters in the text column, and some ...
0
votes
1answer
66 views

Mysql restore all data from Master

MySQl Slave replication server got crashed and I am missing around 60 tables, some table structure and data which present in master and by DB size is more than 25Gb, How I Can restore to resolve ...
2
votes
2answers
166 views

MySQL Server Config, Small Timeframe, Extreme Usage-Scenario

I want to configure a MySQL server for the following scenario. A large amount of users will need to sign up for a university course selecting individual "timeslots". The signup page will open at a ...
2
votes
2answers
2k views

MySQL order by - one column conditional on another column

In MySQL I have a table (simplified for this question) CREATE TABLE `projects` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL, `priority` int(11) DEFAULT '1000000', ...