background preloader

MySQL

Facebook Twitter

13.6.5.1 CASE Syntax. 16.1.1.10 Setting the Master Configuration on the Slave. How to write the Mysql binary log position of master when doing a mysqldump from slave. How To Repair Corrupted MySQL Tables Using myisamchk. By Ramesh Natarajan on September 1, 2008 MyISAM is the default storage engine for MySQL database.

How To Repair Corrupted MySQL Tables Using myisamchk

MyISAM table gets corrupted very easily. In this article, I’ll explain how to use myisamchk to identify and fix table corruption in MyISAM. When a table is created under MySQL, it creates three different files: *.frm file to store table format, *.MYD (MyData) file to store the data, and *.MYI (MyIndex) to store the index.

I prefer to use InnoDB as the storage engine for bigger database, as it resembles Oracle and provides commit, rollback options. Undef error - DBD::mysql::db selectrow_array failed: Table 'attach_data' is marked as crashed and should be repaired [for Statement "SELECT LENGTH(thedata) FROM attach_data WHERE id = ? "] 1. When you redirect the output of myisamchk to a temporary file, it will display only the corrupted table names on the screen. 2. Execute the myisamchk as shown below, with -r option to repair the corrupted tables identified in the above step.

Compressing mysqldump output. The result of mysqldump is a flat text file containing the sql commands used to restore the mysql databases/tables that were dumped.

Compressing mysqldump output

Normally the result of mysqldump is compressed (in regular backups) because the size of the resulted file is normally big and good compression rates are achieved on such text files. Re: Cursor not iterating correctly ... How To Repair MySQL Replication. Version 1.0 Author: Falko Timme <ft [at] falkotimme [dot] com> Last edited 05/29/2008 If you have set up MySQL replication, you probably know this problem: sometimes there are invalid MySQL queries which cause the replication to not work anymore.

How To Repair MySQL Replication

In this short guide I explain how you can repair the replication on the MySQL slave without the need to set it up from scratch again. I do not issue any guarantee that this will work for you! 1 Identifying The Problem To find out whether replication is/is not working and what has caused to stop it, you can take a look at the logs. Grep mysql /var/log/syslog server1:/home/admin# grep mysql /var/log/syslog May 29 09:56:08 http2 mysqld[1380]: 080529 9:56:08 [ERROR] Slave: Error 'Table 'mydb.taggregate_temp_1212047760' doesn't exist' on query. You can see what query caused the error, and at what log position the replication stopped. How to debug InnoDB lock waits at Xaprb.

This article shows you how to use a little-known InnoDB feature to find out what is holding the lock for which an InnoDB transaction is waiting.

How to debug InnoDB lock waits at Xaprb

I then show you how to use an undocumented feature to make this even easier with innotop. Background One of the most common complaints I’ve heard from DBAs used to other database servers is “I can’t find out who holds the locks that are blocking all these connections and making them time out.” I feel your pain. Before I helped scale my employer’s systems to deal with larger volumes of data, InnoDB lock contention was a serious issue. That’s fine, but who holds the lock? InnoDB Lock Monitor Until I learned about the InnoDB Lock Monitor, that is. CREATE TABLE innodb_lock_monitor(a int) ENGINE=INNODB; It’s quite an ugly hack, but it turns out the table name is actually “magical.”

This little-noticed feature makes InnoDB print out a slightly modified version of what you see with SHOW INNODB STATUS. That’s fine, but there are, ah, limitations. Best yet. 11.15.1 GROUP BY (Aggregate) Functions. Mysql development tutorial - having clause - mysql clauses - mysql statements. To list the average salary of employees in different departments (titles), we use the GROUP BY clause, as in:

mysql development tutorial - having clause - mysql clauses - mysql statements

Do we still need innodb_thread_concurrency? What is a modern database?

Do we still need innodb_thread_concurrency?

We have some terms that wander between marketing and technical descriptions - NewSQL, NoSQL. We have much needed work on write-optimized database algorithms - Tokutek, LevelDB, RocksDB, HBase, Cassandra. We also get reports of amazing performance. I think there is too much focus on peak performance and not enough on predictable performance and manageability. Building a DBMS for production workloads is hard. Common mistakes include insufficient monitoring and poor manageability. The best time to think about monitoring is after spending too much time debugging a problem.

Monitoring should be cheap so that it can always be enabled and from this I can understand the average costs and spot changes in load from the weekly push. The goal for monitoring performance problems is to eliminate the use of PMP. The focus on peak performance can be at odds with manageability. How to select the first/least/max row per group in SQL at Xaprb. Thu, Dec 7, 2006 in Databases Here are some common SQL problems, all of which have related solutions: how do I find the most recent log entry for each program?

How to select the first/least/max row per group in SQL at Xaprb