gpt4 book ai didi

MySQL 错误 #1054

转载 作者:行者123 更新时间:2023-11-29 21:51:47 26 4
gpt4 key购买 nike

将数据上传到 mysql 时出现此错误:

#1054 - Unknown column 'aid' in 'field list' "

这是我收到错误 #1054 的部分

CREATE TABLE IF NOT EXISTS `admin` (
`aid` int(11) NOT NULL AUTO_INCREMENT,
`aname` varchar(30) DEFAULT NULL,
`amail` varchar(30) DEFAULT NULL,
`anumber` varchar(30) DEFAULT NULL,
`aip` varchar(30) DEFAULT NULL,
`apass` varchar(50) DEFAULT NULL,
`atime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`city` varchar(30) NOT NULL,
`fb` varchar(100) NOT NULL,
`other` varchar(100) NOT NULL,
PRIMARY KEY (`aid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `admin`
--

INSERT INTO `admin` (`aid`, `aname`, `amail`, `anumber`, `aip`, `apass`, `atime`, `city`, `fb`, `other`) VALUES
(1, 'M SaeeD KhaN NiaZi', 'mianwali@gmail.com', '03437517173', '::1', 'niazi', '2015-07-14 23:00:00', 'MiAnWaLi PAKisTaN', 'www.facebook.com', 'BhAnGi BhAi');

最佳答案

只要该表尚不存在,您的查询就可以正常工作:

CREATE TABLE IF NOT EXISTS `admin` (
^^^^^^^^^^^^^

您可以通过多种方式验证当前表,例如:

show columns from admin;
show create table admin;
select * from admin limit 1;

您还可以在 create table 语句之后添加一个 show warnings; 语句:

mysql> show warnings;
+-------+------+------------------------------+
| Level | Code | Message |
+-------+------+------------------------------+
| Note | 1050 | Table 'admin' already exists |
+-------+------+------------------------------+
1 row in set (0.00 sec)

关于MySQL 错误 #1054,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33565917/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com