Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not create database with MySQL 5.6.37 and InnoDB #33

Closed
blacklion opened this issue Aug 22, 2017 · 3 comments
Closed

Can not create database with MySQL 5.6.37 and InnoDB #33

blacklion opened this issue Aug 22, 2017 · 3 comments

Comments

@blacklion
Copy link
Contributor

I'm migrating from very old version (0.23) to latest one and re-create mysql database.

[opds@onlyone ~/sopds]$ python3 manage.py migrate
Operations to perform:
  Synchronize unmigrated apps: constance, staticfiles, messages
  Apply all migrations: sessions, contenttypes, admin, database, auth, opds_catalog
Synchronizing apps without migrations:
  Creating tables...
    Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying database.0001_initial... OK
  Applying opds_catalog.0001_initial...Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.4/site-packages/django/db/backends/mysql/base.py", line 124, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python3.4/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/lib/python3.4/site-packages/MySQLdb/connections.py", line 42, in defaulterrorhandler
    raise errorvalue
  File "/usr/local/lib/python3.4/site-packages/MySQLdb/cursors.py", line 247, in execute
    res = self._query(query)
  File "/usr/local/lib/python3.4/site-packages/MySQLdb/cursors.py", line 411, in _query
    rowcount = self._do_query(q)
  File "/usr/local/lib/python3.4/site-packages/MySQLdb/cursors.py", line 374, in _do_query
    db.query(q)
  File "/usr/local/lib/python3.4/site-packages/MySQLdb/connections.py", line 277, in query
    _mysql.connection.query(self, query)
_mysql_exceptions.OperationalError: (1071, 'Specified key was too long; max key length is 767 bytes')
@blacklion
Copy link
Contributor Author

Changing all max_length=XXX to max_length=255 (where XXX is larger than 255) for fields with db_index=True doesn't help.

@mitshel
Copy link
Owner

mitshel commented Aug 23, 2017

В README эта ситуация достаточно четко описана:

2.4 Использование InnoDB вместо MyISAM.
Указанная выше конфигурация MySQL использует в качестве движка БД MyISAM, который работает на большинтсве версий MySQL или MariaDB. Однако, если вы используете относительно свежие версии БД Mysql (MariaDB>=10.2.2, Mysql>=5.7.9), то у вас есть возможность использовать более современный движок InnoDB. Он несколько быстрее и поддерживает транзакции, что положительно скажется на целостности БД.
(На более старых версиях MySQL с ним возникают проблемы из-за ограничений на максимальную длину индексов.)

Версия вашего MYSQL не дает возможность использования INNODB с SOPDS из-за ограничений на длину индексов.

@mitshel mitshel closed this as completed Aug 23, 2017
@blacklion
Copy link
Contributor Author

Ох, я невнимательный, прошу прощения за беспокойство.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants