|
|
| Line 491: |
Line 491: |
| * 如果您正在使用控制台命令,如果密碼包含特殊字元,請轉義密碼,例如 {{kbd | key=<nowiki>mysql -u root -p'PASSWORD'</nowiki>}}<ref>[http://superuser.com/questions/123928/escaping-a-password-using-mysqldump-console 使用 mysqldump 控制台轉義密碼 - Super User]</ref> | | * 如果您正在使用控制台命令,如果密碼包含特殊字元,請轉義密碼,例如 {{kbd | key=<nowiki>mysql -u root -p'PASSWORD'</nowiki>}}<ref>[http://superuser.com/questions/123928/escaping-a-password-using-mysqldump-console 使用 mysqldump 控制台轉義密碼 - Super User]</ref> |
| * 您可能需要刪除現有的帳戶設定並重新配置。 | | * 您可能需要刪除現有的帳戶設定並重新配置。 |
|
| |
| == 錯誤 1070 (42000): 指定的鍵太長;最大鍵長為 767 位元組 ==
| |
| '''環境''': MySQL 5.6
| |
|
| |
| '''根本原因''': "預設情況下,索引鍵前綴長度限制為 767 位元組。參見第 13.1.13 節,“CREATE INDEX 語句”。例如,在 TEXT 或 VARCHAR 列上,如果使用 utf8mb3 字元集,並且每個字元最多 3 位元組,您可能會在列前綴索引超過 255 個字元時達到此限制。當啟用 innodb_large_prefix 配置選項時,對於使用 DYNAMIC 或 COMPRESSED 行格式的 InnoDB 表,索引鍵前綴長度限制提高到 3072 位元組。" <ref>[https://dev.mysql.com/doc/refman/5.6/en/innodb-limits.html MySQL :: MySQL 5.6 參考手冊 :: 14.22 InnoDB 限制]</ref>
| |
|
| |
| '''解決方案'''<ref>[https://www.opencli.com/mysql/mysql-%E5%95%8F%E9%A1%8C-1071-42000-specified-key-was-too-long MySQL 問題: 1071 (42000): 指定的鍵太長]</ref><ref>[https://terrytongcc.com/%E5%A6%82%E4%BD%95%E8%A7%A3%E6%B1%BAmysql%E5%87%BA%E7%8F%BEerror-1118-row-size-too-large-8126%E5%95%8F%E9%A1%8C/ 如何解決 MySQL 出現 Error 1118: row size too large (> 8126) 問題 | Terry Tong – 全棧 Web 開發人員]</ref>:
| |
| * 執行以下 SQL 查詢:
| |
|
| |
| <pre>
| |
| SET GLOBAL innodb_file_format = Barracuda;
| |
| SET GLOBAL innodb_file_format_max = Barracuda;
| |
| </pre>
| |
|
| |
| * 修改 MySQL 配置文件
| |
| <pre>
| |
| innodb_file_per_table = 1
| |
| innodb-file-format = BARRACUDA
| |
| innodb-large-prefix = ON
| |
| innodb_file_format_max = BARRACUDA
| |
| </pre>
| |
|
| |
| * 重啟 MySQL 伺服器
| |
|
| |
| * 執行以下 SQL 查詢:
| |
| <pre>
| |
| ALTER TABLE `table_name` ROW_FORMAT=COMPRESSED;
| |
| </pre>
| |
|
| |
|
| == 錯誤 1366: 字串值不正確 == | | == 錯誤 1366: 字串值不正確 == |