6

Please help me I get the error

#1286 - Unknown storage engine 'InnoDB'

running this query:

    CREATE TABLE IF NOT EXISTS `tbl_prize` (
  `prize_id` int(11) NOT NULL,
  `prize` int(11) NOT NULL,
  `chance` int(11) NOT NULL DEFAULT '1'
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
ALTER TABLE `tbl_prize`  ADD PRIMARY KEY (`prize_id`);
ALTER TABLE `tbl_prize` MODIFY `prize_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;
INSERT INTO `tbl_prize` (`prize_id`, `prize`, `chance`) VALUES(1, 100, 1),(2, 200, 1);

CREATE TABLE IF NOT EXISTS `tbl_user` (
  `user_id` int(11) NOT NULL,
  `reffer_id` int(11) DEFAULT NULL,
  `wallet` varchar(500) NOT NULL,
  `ref_pending` int(11) unsigned NOT NULL DEFAULT '0',
  `earn` int(11) unsigned NOT NULL DEFAULT '0',
  `playnum` int(11) unsigned NOT NULL,
  `ip` int(10) unsigned DEFAULT NULL,
  `reset` int(4) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


ALTER TABLE `tbl_user`
  ADD PRIMARY KEY (`user_id`),
  ADD KEY `reffer_id` (`reffer_id`),
  ADD KEY `username` (`wallet`),
  ADD KEY `ref_pending` (`ref_pending`),
  ADD KEY `ip` (`ip`),
  ADD KEY `reset` (`reset`);


ALTER TABLE `tbl_user`
  MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT;


ALTER TABLE `tbl_user`
  ADD CONSTRAINT `tbl_user_ibfk_1` FOREIGN KEY (`reffer_id`) REFERENCES `tbl_user` (`user_id`) ON DELETE SET NULL;    
Filburt
  • 17,626
  • 12
  • 64
  • 115
stephen lunzaga
  • 61
  • 1
  • 1
  • 3
  • I just edited it.Please help me :) – stephen lunzaga Mar 28 '17 at 10:42
  • `An error` means just nothing. Provide what you are trying to do and where the problems are. If you get an error, post it. It wont hurt anyone to see which kind of error appears. – C4d Mar 28 '17 at 10:50
  • what i want to do is to run the query but i get the error "#1286 - Unknown storage engine 'InnoDB'" when I execute the query ..I dont know anything with mysql or databases and im just following a video tutorial .. I wish I understand the query so I can figure out where the problem is :( – stephen lunzaga Mar 28 '17 at 11:00
  • The problem is not in the query: it's in the configuration of the database. – Peter Taylor Mar 28 '17 at 11:16
  • Check `mysqld.err` to see if InnoDB had trouble starting up. – Rick James Mar 31 '17 at 03:35

1 Answers1

5

The MySQL server is generally configured using one of these storage engines:

  • InnoDB (usually default)
  • MyISAM

Other engines exists though.

You problem lays in the ENGINE=InnoDB part of the query. You can eventually try to erase this, if you don't care about the storage engine.

Another solution (the hard one if you don't know about database servers) is to change the storage engine in configuration. If you are able/authorized to do it, configure your database engine using InnoDB. Find the my.cnf file and set default-storage-engine to InnoDB. Other parameters should also be changed in order to make this work (see references).

Note: if your MySQL server already contains data, you need to backup it before.

References:

smonff
  • 3,399
  • 3
  • 36
  • 46