MySQL index key length
In the development, two varchar 1000 fields are associated. As a MySQL index white, I directly add a normal index to the table. This will report an error, saying that the length of my index is too long. Search on the Internet is to change the MySQL configuration file. By chance, I saw an article sent by a big man, and I knew that the index length of MySQL was such a usage.
Error reported by MySQL: 1071 – specified key was too long; max key length is 3072 bytes
SELECT
ROUND(SUM(LENGTH(`school_unit_title`)<10)*100/COUNT(`school_unit_title`),2) AS pct_length_10,
ROUND(SUM(LENGTH(`school_unit_title`)<20)*100/COUNT(`school_unit_title`),2) AS pct_length_20,
ROUND(SUM(LENGTH(`school_unit_title`)<50)*100/COUNT(`school_unit_title`),2) AS pct_length_50,
ROUND(SUM(LENGTH(`school_unit_title`)<80)*100/COUNT(`school_unit_title`),2) AS pct_length_80,
ROUND(SUM(LENGTH(`school_unit_title`)<100)*100/COUNT(`school_unit_title`),2) AS pct_length_100
FROM `z_school_unit`;
Read More:
- [Solved] EOS7.6 Error: Init DB failed [Specified key was too long; max key length is 767 bytes…
- Error creating foreign key in MySQL: 1215 cannot add the foreign key constraint
- [305]MYSQL 1062 error: duplicate entry ‘…’ for key ‘primary
- [Solved] public key is not available client side (option serverRsaPublicKeyFile not set)
- Error 1406 (22001) in MySQL: data too long for column (Fixed)
- SQL Server Deletes a table foreign key constraint Error [Solved]
- How to Solve Error: Rsa Public Key not Find
- Hive install initialization error: Error: Duplicate key name ‘PCS_STATS_IDX‘ (state=42000,code=1061)
- Error running ‘Application‘: Command line is too long [How to Solve]
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- The setobject() method reports an error. The parameter index out of range and MySQL syntax error exception report an error
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- MySQL Build table error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser
- host ‘‘ is not allowed to connect to this mysql server Connect MYSQL Error
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- [Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query