我刚刚创建了一个mysql表
CREATE TABLE `accounts` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(16) NOT NULL,
`password` char(40) NOT NULL,
`banned` tinyint(1) NOT NULL DEFAULT '0',
`active` int(11) NOT NULL DEFAULT '0',
`created_on` datetime DEFAULT CURRENT_TIMESTAMP,
`last_logged` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`user_id`),
KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
以下查询可按预期100%起作用:
Select name from accounts;
Select * from accounts;
但是,以下查询导致错误(或类似结果) “字段列表”中的未知列“ user_id”
Select user_id from accounts;
Select `user_id` from accounts
Select accounts.user_id from accounts
Select active from accounts;
我刚刚删除了所有表并重新创建了它们,但仍然遇到此问题。