MySQL Error 1170 (42000): BLOB/TEXT Column Used in Key Specification Without a Key Length خطأ في الخلية 1170 (42000) : النقطه (نص العمود الرئيسية المستخدمة في تحديد بدون طول المفتاح
When creating a new table or altering an existing table with primary keys, unique constraints and indexes, or when defining a new index with Alter Table manipulation statement in MySQL database, the following error may occur and prohibit the the command from completing: عند انشاء جدول جديد او تغيير الجدول موجود مع المفاتيح الاساسية ، فريدة من نوعها والقيود والارقام القياسيه ، او عند وضع تعريف جديد مع تغيير الجدول الرقم القياسي للتلاعب في بيان قاعدة بيانات الخلية ، والخطأ التالية قد تحدث وحظر قيادة من انجاز :
ERROR 1170 (42000): BLOB/TEXT column ‘field_name’ used in key specification without a key length خطأ في 1170 (42000) : النقطه (نص العمود 'field_name' التي استخدمت في المواصفات الرئيسية بدون طول المفتاح
The error happens because MySQL can index only the first N chars of a BLOB or TEXT column. الخطأ يمكن ان يحدث لأن مؤشر الخلية الأولى فقط من حروف ا ن النقطه العمود او النص. So The error mainly happen when there is a field/column type of TEXT or BLOB or those belongs to TEXT or BLOB types such as TINYBLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, MEDIUMTEXT, and LONGTEXT that you try to make as primary key or index. حتى الخطأ اساسا يحدث عندما يكون ثمة مجال / العمود النوع من النص او النقطه او تلك التي تنتمي الى النص او النقطه انواع مثل tinyblob ، mediumblob ، longblob ، tinytext ، mediumtext ، longtext والتي تحاول ان تجعل المفتاح الاساسي او حسب الرقم القياسي. With full BLOB or TEXT without the length value, MySQL is unable to guarantee the uniqueness of the column as it’s of variable and dynamic size. النقطه الكاملة مع او بدون نص طول قيمة ، والخلية هي غير قادرة على ضمان الطابع الفريد للعمود كما انه متغير من حجم وديناميه. So, when using BLOB or TEXT types as index, the value of N must be supplied so that MySQL can determine the key length. ذلك ، عند استخدام النقطه أو أنواع كما نص الرقم القياسي ، فان قيمة ن ويجب ان الخلية بحيث يمكن ان تحدد طول المفتاح. However, MySQL doesn’t support limit on TEXT or BLOB. غير ان الخلية لا يدعم نص على الحد او النقطه. TEXT(88) simply won’t work. نص (88) ببساطة لن ينجح.
The error will also pop up when you try to convert a table column from non-TEXT and non-BLOB type such as VARCHAR and ENUM into TEXT or BLOB type, with the column already been defined as unique constraints or index. الخطأ ايضا البوب حتى عند محاولة لتحويل عمود الجدول من غير نص وغير نوع النقطه مثل varchar والى نص انجليزى او نوع النقطه ، مع العمود سبق أن تعرف بأنها فريدة من نوعها او القيود الرقم القياسي. The Alter Table SQL command will fail. وقد تغير الجدول لغة الاستعلامات البنيويه قيادة مصيرها الفشل.
The solution to the problem is to remove the TEXT or BLOB column from the index or unique constraint, or set another field as primary key. الحل لهذه المشكلة هو ازالة النص او العمود النقطه من مؤشر القيد او فريدة ، او مجموعة اخرى المجال المفتاح الاساسي. If you can’t do that, and wanting to place a limit on the TEXT or BLOB column, try to use VARCHAR type and place a limit of length on it. اذا كنت لا تستطيع ان تفعل ذلك ، وتسعى لفرض حد على النص أو العمود النقطه ، محاولة لاستخدام نوع varchar ووضع حد على طول. By default, VARCHAR is limited to a maximum of 255 characters and its limit must be specified implicitly within a bracket right after its declaration, ie VARCHAR(200) will limit it to 200 characters long only. افتراضيا ، varchar هو الحد الأقصى هو 255 حرفا ، ويجب تحديد الحد ضمنا ضمن الشريحه بعد اعلان الحق ، أي varchar (200) لانها سوف تحد من 200 حرفا فقط.
Sometimes, even though you don’t use TEXT or BLOB related type in your table, the Error 1170 may also appear. في بعض الأحيان ، على الرغم من انك لا تستخدم النص او نوع النقطه ذات الصلة في الجدول الخاص بك ، خطأ 1170 كما قد تظهر. It happens in situation such as when you specify VARCHAR column as primary key, but wrongly set its length or characters size. يحدث في مثل هذه الحاله كما هو الحال عندما تقوم أنت بتحديد العمود كما varchar المفتاح الأساسي ، ولكنه خطأ في تحديد طول او حجم الحروف. VARCHAR can only accepts up to 256 characters, so anything such as VARCHAR(512) will force MySQL to auto-convert the VARCHAR(512) to a SMALLTEXT datatype, which subsequently fail with error 1170 on key length if the column is used as primary key or unique or non-unique index. Varchar لا يمكن الا ان تقبل حتى 256 حرفا ، وذلك مثل أي شيء varchar (512) وسوف قوة الخلية الى تحويل السيارات varchar (512) الى smalltext البيانات ، التي فشلت فى وقت لاحق مع 1170 خطا على طول المفتاح اذا استعملت على انها العمود الأساسي مفتاح او فريدة او غير الرقم القياسي فريدة من نوعها. To solve this problem, specify a figure less than 256 as the size for VARCHAR field. لحل هذه المشكلة ، وتحديد الرقم اقل من 256 كما لحجم varchar الميدان.
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. هام : هذا هو الاله الذي ترجم صفحة مقدمة "كما هى" دون ضمان. Machine translation may be difficult to understand. الترجمة الاليه قد يكون من الصعب ان نفهم. Please refer to يرجى الرجوع الى original English article المادة الاصليه English whenever possible. كلما كان ذلك ممكنا.
Share and contribute or get technical support and help at والمساهمة في حصة او الحصول على الدعم التقني والمساعدة فى My Digital Life Forums بلدي الرقميه الحياة المنتديات .
Related Articles مقالات ذات صلة
- How to Convert Character Set and Collation of WordPress Database كيفية تحويل مجموعة الحروف وجمع قاعدة بيانات WordPress
- Installing Web Server in FreeBSD 6.0 with Apache 2.2, MySQL 5.0 and PHP 5 - Part 3 تركيب خادم الويب مع 6،0 في فري بي. اس. دي اباتشي 2،2 ، 5،0 الخلية وبي. اتش. بى 5 -- الجزء 3
- Create New Table by Selecting Data from Other Tables with CREATE TABLE AS انشاء جدول جديد عن طريق اختيار البيانات من الجداول الاخرى مع انشاء المائدة
- Install Web Server in Windows XP with Apache2, PHP5 and MySQL4 - Part 4 تثبيت خادم الويب في ويندوز اكس بي مع apache2 ، php5 وmysql4 -- الجزء 4
- Change and Reset MySQL root Password تغيير الخلية الجذريه واعادة ضبط كلمة السر
- ORA-02449 Oracle Drop Table Error Ora - 02449 اوراكل إسقاط الجدول خطأ
- Enable MySQL InnoDB Storage Engine Support in XAMPP Installation تمكين الخلية innodb تخزين محرك في دعم تركيب xampp
- WordPress MySQL SQL Query Error in WPDB Class WordPress الخلية لغة الاستعلامات البنيويه استفسار خطأ في الدرجة wpdb
- Easily Duplicate, Copy or Backup Tables in Oracle, PostgreSQL, DB2 and SQLite with Create Table As SQL بسهولة المكرره ، أو نسخة احتياطية الجداول في أوراكل ، PostgreSQL ، DB2 وsqlite إيجاد طاولة مع لغة الاستعلامات البنيويه
- Oracle PL/SQL ORA-00947 Not Enough Values Error اوراكل رر / لغة الاستعلامات البنيويه ora - 00947 القيم لا يكفي خطأ

































August 30th, 2007 18:33 اب / اغسطس 30th ، 2007 18:33
Thanks for putting this up. شكرا لطرح هذا الموضوع. I didn’t get the error and you saved me a lot o frustration. انا لم احصل على خطأ وانت انقذت لي الكثير س الاحباط. I’d put you in the ‘Goog people’ category anytime انا كنت في 'GOOG الشعب فئة في اي وقت
February 20th, 2008 02:45 شباط / فبراير 20th ، 2008 02:45 النشرة
Thanks! شكرا! Very useful post. وظيفة مفيدة جدا.
February 23rd, 2008 03:40 شباط / فبراير 23rd ، 2008 03:40
Thanks for the post. شكرا لهذا المنصب. Very helpful. مفيدة جدا.
March 7th, 2008 04:15 مارس 7th ، 2008 04:15
Thanks, very good defined شكرا ، تعرف جيدا جدا