MySQLdump Got error: 29

mysql-logo

ใช้ Mysql Dump แล้วเจอ error ตามนี้mysqldump: Got error: 29: File './thaiavTmp/Shop_Ext.MYD' not found (Errcode: 24) when using LOCK TABLE
เค้าบอกว่าให้ไปเพิ่ม config open_files_limit to 8192
( ปกติมันจะ open_files_limit = 512) แค่นี้ก็หายแล้ว

MySQL Incorrect key file for table

126 Incorrect key file for table '/tmp/#sql_767b_0.MYI'; try to repair it

พบปัญหา user ไม่สามารถใช้งาน บาง function ใน Portal ได้ โดยมี error ตามด้านบน ไล่ตามจนไปเจอ query 1 ตัวที่ ralate กับ user id 18 เท่านั้น
ปัญหาคือ disk ที่เก็บไฟล์ temp table เต็ม เข้าใจว่าถ้าไม่ได้ config tmp directory ไว้ MySQL จะมีค่า default ของ tmp directory อยู่ที่ /tmp, /usr/tmp, /var/tmp อย่างใดอย่างหนึง แต่ case ที่เจอ สงสัยว่าจะไปอยู่ใน memory เพราะ disk ยังมีพื้นที่อีกเยอะ วิธีแก้ใข ให้ไปเพิ่ม config ที่ my.cnf แล้ว reboot server (restart service ใช้ไม่ได้ผล)

tmpdir = /var/tmp

Recover MySQL password

พอดีลงแอบ MySQL บน Leopard ในห้องประชุม เลยจำ password root ไม่ได้ ต้องไปตามหาวิธี recover password อีกจนได้ จดไว้กันลืม เผื่อพลาดอีก

  1. Stop MySQL service ก่อน จะด้วยวิธียังไงก็แล้วแต่ OS เลย
  2. Start MySQL safe mode
    # mysqld_safe --skip-grant-tables &
  3. ระหว่างนี้ก็เปิด Terminal อีกอันนึงเลย แล้วจัดการ login เข้าไปเปลี่ยน password
    # mysql -u root
  4. เปลี่ยน password
    mysql> use mysql;
    mysql> UPDATE user SET password=PASSWORD('pass');
  5. Reload สิทธิ
    mysql> flush privileges;
  6. Stop/Start MySQL อีกที เป็นอันเสร็จ