1

由于某种原因,Sequelize 无法创建其元表:

$ sequelize db:migrate

Sequelize [Node: 6.10.2, CLI: 2.7.0, ORM: 3.30.4]

Loaded configuration file "config\config.json".
Using environment "development".
{ SequelizeDatabaseError: ER_CANT_CREATE_TABLE: Can't create table 'SequelizeMeta' (errno: 30)
    at Query.formatError (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\dialects\mysql\query.js:175:14)
    at Query._callback (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\dialects\mysql\query.js:49:21)
    at Query.Sequence.end (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\sequences\Sequence.js:86:24)
    at Query.ErrorPacket (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\sequences\Query.js:88:8)
    at Protocol._parsePacket (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Protocol.js:280:23)
    at Parser.write (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Parser.js:75:12)
    at Protocol.write (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Protocol.js:39:16)
    at Socket.<anonymous> (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\Connection.js:103:28)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:551:20)
  name: 'SequelizeDatabaseError',
  message: 'ER_CANT_CREATE_TABLE: Can\'t create table \'SequelizeMeta\' (errno: 30)',
  parent:
   { Error: ER_CANT_CREATE_TABLE: Can't create table 'SequelizeMeta' (errno: 30)
       at Query.Sequence._packetToError (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\sequences\Sequence.js:52:14)
       at Query.ErrorPacket (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\sequences\Query.js:77:18)
       at Protocol._parsePacket (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Protocol.js:280:23)
       at Parser.write (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Parser.js:75:12)
       at Protocol.write (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Protocol.js:39:16)
       at Socket.<anonymous> (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\Connection.js:103:28)
       at emitOne (events.js:96:13)
       at Socket.emit (events.js:188:7)
       at readableAddChunk (_stream_readable.js:176:18)
       at Socket.Readable.push (_stream_readable.js:134:10)
       at TCP.onread (net.js:551:20)
       --------------------
       at Protocol._enqueue (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Protocol.js:141:48)
       at Connection.query (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\Connection.js:208:25)
       at c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\dialects\mysql\query.js:40:21
       at Promise._execute (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\debuggability.js:300:9)
       at Promise._resolveFromExecutor (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:483:18)
       at new Promise (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:79:10)
       at Query.run (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\dialects\mysql\query.js:39:17)
       at c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\sequelize.js:849:20
       at c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\retry-as-promised\index.js:40:21
       at Promise._execute (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\debuggability.js:300:9)
       at Promise._resolveFromExecutor (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:483:18)
       at new Promise (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:79:10)
       at retryAsPromised (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\retry-as-promised\index.js:30:10)
       at c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\sequelize.js:848:12
       at tryCatcher (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\util.js:16:23)
       at Promise._settlePromiseFromHandler (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:512:31)
       at Promise._settlePromise (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:569:18)
       at Promise._settlePromise0 (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:614:10)
       at Promise._settlePromises (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:693:18)
       at Async._drainQueue (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\async.js:133:16)
       at Async._drainQueues (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\async.js:143:10)
       at Immediate.Async.drainQueues (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\async.js:17:14)
     code: 'ER_CANT_CREATE_TABLE',
     errno: 1005,
     sqlState: 'HY000',
     index: 0,
     sql: 'CREATE TABLE IF NOT EXISTS `SequelizeMeta` (`name` VARCHAR(255) NOT NULL UNIQUE , UNIQUE `SequelizeMeta_name_unique` (`name`), PRIMARY KEY (`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;' },
  original:
   { Error: ER_CANT_CREATE_TABLE: Can't create table 'SequelizeMeta' (errno: 30)
       at Query.Sequence._packetToError (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\sequences\Sequence.js:52:14)
       at Query.ErrorPacket (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\sequences\Query.js:77:18)
       at Protocol._parsePacket (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Protocol.js:280:23)
       at Parser.write (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Parser.js:75:12)
       at Protocol.write (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Protocol.js:39:16)
       at Socket.<anonymous> (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\Connection.js:103:28)
       at emitOne (events.js:96:13)
       at Socket.emit (events.js:188:7)
       at readableAddChunk (_stream_readable.js:176:18)
       at Socket.Readable.push (_stream_readable.js:134:10)
       at TCP.onread (net.js:551:20)
       --------------------
       at Protocol._enqueue (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\protocol\Protocol.js:141:48)
       at Connection.query (c:\Users\shi\AppData\Roaming\npm\node_modules\mysql\lib\Connection.js:208:25)
       at c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\dialects\mysql\query.js:40:21
       at Promise._execute (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\debuggability.js:300:9)
       at Promise._resolveFromExecutor (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:483:18)
       at new Promise (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:79:10)
       at Query.run (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\dialects\mysql\query.js:39:17)
       at c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\sequelize.js:849:20
       at c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\retry-as-promised\index.js:40:21
       at Promise._execute (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\debuggability.js:300:9)
       at Promise._resolveFromExecutor (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:483:18)
       at new Promise (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:79:10)
       at retryAsPromised (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\retry-as-promised\index.js:30:10)
       at c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\lib\sequelize.js:848:12
       at tryCatcher (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\util.js:16:23)
       at Promise._settlePromiseFromHandler (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:512:31)
       at Promise._settlePromise (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:569:18)
       at Promise._settlePromise0 (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:614:10)
       at Promise._settlePromises (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\promise.js:693:18)
       at Async._drainQueue (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\async.js:133:16)
       at Async._drainQueues (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\async.js:143:10)
       at Immediate.Async.drainQueues (c:\Users\shi\AppData\Roaming\npm\node_modules\sequelize\node_modules\bluebird\js\release\async.js:17:14)
     code: 'ER_CANT_CREATE_TABLE',
     errno: 1005,
     sqlState: 'HY000',
     index: 0,
     sql: 'CREATE TABLE IF NOT EXISTS `SequelizeMeta` (`name` VARCHAR(255) NOT NULL UNIQUE , UNIQUE `SequelizeMeta_name_unique` (`name`), PRIMARY KEY (`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;' },
  sql: 'CREATE TABLE IF NOT EXISTS `SequelizeMeta` (`name` VARCHAR(255) NOT NULL UNIQUE , UNIQUE `SequelizeMeta_name_unique` (`name`), PRIMARY KEY (`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;' }

即使我直接使用 SQL 命令它仍然不起作用:

mysql> CREATE TABLE IF NOT EXISTS `SequelizeMeta` (`name` VARCHAR(255) NOT NULL UNIQUE , UNIQUE `SequelizeMeta_name_unique` (`name`), PRIMARY KEY (`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;
1005 - Can't create table 'SequelizeMeta' (errno: 30)

任何想法可能导致它?

4

1 回答 1

1

errno: 30linux 是只读文件系统的代名词。显然,这不能通过更改 sequelize 中的任何内容来解决:)

您必须更正文件系统权限,否则文件系统很可能已损坏并且操作系统已关闭写入以防止进一步损坏。

于 2017-05-24T10:09:33.030 回答