M.Kürşad Dara

I believe my mind and became a genius.

Archive for the ‘MySQL’ Category

ERROR 126 (HY000): Incorrect key file for table ‘/mnt/mysql-tmp/#sql_1a76_2.MYI’; try to repair it hatası

leave a comment

mySQL de bir query çalıştırdığınızda;

ERROR 126 (HY000): Incorrect key file for table '/mnt/mysql-tmp/#sql_1a76_2.MYI'; try to repair it

hatasını alıyorsanız bunun birkaç sebebi olabilir.

1. mySQL’in temp tabloları oluşturduğu dizini RAM üzerinde oluşturacak şekilde ayırdıysanız ve örneğin 2GB alan verdiyseniz ve gönderdiğiniz querynin oluşturduğu temp tablosu 2GB’tan büyük ise bu hatayı alırsınız. Bunun çözümü ya RAM’de temp tablo için ayırdığınız alanı artıracaksınız ya da querynizi optimize edeceksiniz.

/dev/ram1             2.0G     0  2.0G   0% /mnt/mysql-tmp
kursad:/mnt/mysql-tmp # ls -la /mnt/mysql-tmp/
total 2.0G
drwxrwxrwt 2 root  root    80 Feb 16 11:01 .
drwxr-xr-x 9 root  root  4.0K Feb 15 14:16 ..
-rw-rw---- 1 mysql mysql 2.0G Feb 16 11:01 #sql_1a76_0.MYD
-rw-rw---- 1 mysql mysql 1.0K Feb 16 11:01 #sql_1a76_0.MYI

2. İlgili tablo bozuk olabilir. Repair edip sorunu çözebilirsiniz.

Popularity: 1% [?]

Written by M.Kürşad DARA

February 16th, 2012 at 11:06 am

InnoDB: Unable to lock ./xxxxxx/xxxxx.ibd, error: 11 hatası.

leave a comment

InnoDB bir veritabanında sunucuyu resetledikten sonra aşağıdaki hatayı aldık.

120209 05:12:29 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/
120209  5:12:29 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
120209  5:12:29  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Unable to lock ./xxxxxx/xxxxx.ibd, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
120209  5:12:29  InnoDB: Assertion failure in thread 47546054463296 in file fil/fil0fil.c line 635
InnoDB: Failing assertion: ret
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: about forcing recovery.
120209  5:12:29 - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=104857600
read_buffer_size=52428800
max_used_connections=0
max_threads=512
threads_connected=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 52536408 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = (nil) thread_stack 0x40000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x2e)[0x8ad46e]
/usr/local/mysql/bin/mysqld(handle_segfault+0x322)[0x5e05c2]
/lib64/libpthread.so.0[0x39a0a0e4c0]
/lib64/libc.so.6(gsignal+0x35)[0x39a0230215]
/lib64/libc.so.6(abort+0x110)[0x39a0231cc0]
/usr/local/mysql/bin/mysqld[0x7acc5c]
/usr/local/mysql/bin/mysqld[0x7acdf9]
/usr/local/mysql/bin/mysqld(fil_space_get_size+0xde)[0x7b407e]
/usr/local/mysql/bin/mysqld(fil_check_adress_in_tablespace+0x9)[0x7b4159]
/usr/local/mysql/bin/mysqld(trx_sys_doublewrite_init_or_restore_pages+0x2d5)[0x82b6d5]
/usr/local/mysql/bin/mysqld(recv_recovery_from_checkpoint_start+0x175b)[0x7dbe0b]
/usr/local/mysql/bin/mysqld(innobase_start_or_create_for_mysql+0x115f)[0x81b8cf]
/usr/local/mysql/bin/mysqld[0x777d64]
/usr/local/mysql/bin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x31)[0x6cf411]
/usr/local/mysql/bin/mysqld[0x75513a]
/usr/local/mysql/bin/mysqld(_Z11plugin_initPiPPci+0x875)[0x757c95]
/usr/local/mysql/bin/mysqld[0x5e0d95]
/usr/local/mysql/bin/mysqld(main+0x1c1)[0x5e50b1]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x39a021d974]
/usr/local/mysql/bin/mysqld(fmod+0x62)[0x513c0a]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
120209 05:12:29 mysqld_safe mysqld from pid file /usr/local/mysql/data//xxxxxx.pid ended

Çözüm olarak mysql i durdurup *.ibd dosyalarını taşıyıp tekrar cp -a ile kopyaladık ve mysql i çalıştırdık sorunumuz düzeldi.

Basit shell script şöyle :

#!/bin/bash
for i in `ls -a *.ibd`
do
  mv $i $i.bak
  cp -a $i.bak $i
done

Popularity: 1% [?]

Written by M.Kürşad DARA

February 9th, 2012 at 10:25 am

Posted in Linux,MySQL

Tagged with , , ,

mySQL `ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction` hatası

leave a comment

Herhangi bir mySQL’de InnodB olan bir veritabanında update gibi table-lock koyan sorgusu çalıştırırken

ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

hatasını alıyorsanız, konfigürasyon dosyasından

innodb_lock_wait_timeout=300

ekleyip mySQL i yeniden başlatırsanız sorununuz çözülecektir. Parametrenin değeri olan 300 saniye cinsindendir ve varsayılan değeri 50 sn. dir.

Bakınız : http://dev.mysql.com/doc/refman/5.0/en/innodb-parameters.html#sysvar_innodb_lock_wait_timeout

Popularity: 1% [?]

Written by M.Kürşad DARA

January 9th, 2012 at 2:30 pm

log_bin_trust_function_creators problemi

leave a comment

MySQL’de fonksiyon oluşturmaya çalışırken aşağıdaki hatalar ile karşılaşıyorsanız çözüm kolay.
Binary log aktif edilmiş ise bu hatayı alırsınız.

ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
ERROR 1418 (HY000): This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe  og_bin_trust_function_creators variable) 

Çözmek için MySQL komut satırından aşağıdaki komutu yazın.

SET GLOBAL log_bin_trust_function_creators = 1;

Fonksiyon oluşturma işiniz bittiğinde bu değeri tekrar varsayılan haline döndürmeniz tavsiye edilir. Çünkü bu paremetrenin bilinen iki handikapı vardır :

1. Master veritabanı slave veritabanına senkronize olurken arada veri kaybı yaşayabilirsiniz.
2. Restore ettiğiniz veriler orjinal verilerden farklı olabilir.

Daha detaylı bilgi için :

http://dev.mysql.com/doc/refman/5.1/en/stored-procedure-logging.html

inceleyebilirsiniz.

Popularity: 1% [?]

Written by M.Kürşad DARA

May 23rd, 2008 at 12:39 pm

Windows’tan Linux’e mySQL taşıdıktan sonrası…

leave a comment

Eğer Windows’taki mySQL veritabanınızı Linux altına taşımak durumunda kalırsanız ve kod tarafında tablo isimlerini büyük küçük harfe dikkat etmeden kullandı iseniz sorunla karşılaşabilirsiniz. O yüzden /etc/my.cnf dosyasına aşağıdaki parametreki eklerseniz bu sorun ile uğraşmak zorunda kalmanız gerekmeyecek.

lower_case_table_names=1

Popularity: 1% [?]

Written by M.Kürşad DARA

May 23rd, 2008 at 12:30 pm

mysql X line(s) were cut by GROUP_CONCAT()

leave a comment

bu hatayı alıyorsanız sql querylerinde concat kullandığınızda aşağıdaki şekilde çözebilirsiniz.

select @@global.group_concat_max_len;
@@group_concat_max_len: 5000;

bu değeri kendinize göre ayarlayabilirsiniz.

Popularity: 3% [?]

Written by M.Kürşad DARA

May 2nd, 2008 at 1:15 pm

Posted in MySQL

Tagged with

mysql [ERROR] Could not open log file hatası

leave a comment

mysql kurulum dizini altından *.index dosyalarını silip mysql i restart edin.

Popularity: 1% [?]

Written by M.Kürşad DARA

May 2nd, 2008 at 7:02 am

Posted in MySQL

Tagged with

mysql Cannot call SHOW INNODB STATUS because skip-innodb is defined hatası

leave a comment

mysql de innodb disabled olmuş ise ve config dosyasında skip_innodb yok ise yapmanız gereken şudur :

mysql kurulum dizini altındaki ib_logfile0 ve ib_logfile1 dosyalarını silip mysql i restart etmek.

Popularity: 2% [?]

Written by M.Kürşad DARA

May 2nd, 2008 at 7:01 am

ERROR 1607 (HY000): Cannot create stored routine hatası

leave a comment

MySQL’de procedure ya da function oluştururken

ERROR 1607 (HY000): Cannot create stored routine `< ....>`. Check warnings 

şeklinde bir hata alıyorsanız yapmanız gereken sorgularınızın başına

SET @@sql_mode := "";

yazmanız olacaktır.

Bu problem su an için MySQL 5.1.23-rc versiyonunda var. Bildiğim kadarı ile herhangi bir patch yayınlanmadı. Bir sonraki versiyonlarda çözüleceğinden bahsediliyor.

Boşu boşuna kafayı yememeniz için :)

Popularity: 3% [?]

Written by M.Kürşad DARA

March 10th, 2008 at 11:47 am

MySQL transactional enginelerin karşılaştırılması

leave a comment

İncelemekte fayda var.

MySQL transactional enginelerin karşılaştırılması

Popularity: 1% [?]

Written by M.Kürşad DARA

January 11th, 2008 at 12:25 am

Posted in MySQL

Tagged with , ,