ERROR 1062 (23000): Duplicate entry '1' for key 'id'
有unique约束,插入数据重复
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
auto_increment字段必须定义一个键(key),primary或unique
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (test.test_1_1, CONSTRAINT fk_test_1 FOREIGN KEY (id) REFERENCES test_1 (id) ON DELETE SET NULL ON UPDATE CASCADE)
被关联的表中没有数据
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'foreign key(teacher_id) references teacher(tid) on delete cascade on update cascade' at line 1
别关联的表中必须有数据才能够关联,不然会报错
ERROR 1022 (23000): Can't write; duplicate key in table '#sql-13ce_5'
使用alter添加约束的名称和已经存在的约束名称相同
ERROR 1364 (HY000): Field 'age' doesn't have a default value
age字段没有默认值
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'day40.employee.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
必须有group的字段
ERROR 1093 (HY000): You can't specify target table 'book' for update in FROM clause
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'day40.staff.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
ERROR 1242 (21000): Subquery returns more than 1 row
子查询返回值为多个
ERROR 1052 (23000): Column 'sid' in field list is ambiguous
sid字段位置模糊,通常须要给table命别名,或者使用具题table’s name指定便可
ERROR 1248 (42000): Every derived table must have its own alias
每一个初始表必须有一个别名
ERROR 1630 (42000): FUNCTION t2.max does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
若是使用聚合函数获得的值,须要手动指定名称
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' ([Errno 61] Connection refused)")
经过socket链接mysql出错,一般是默认参数和传参出现问题
默认端口号3306,能够经过sudo lsof -i:3306查看
host中能够使用localhost或127.0.0.1测试
AttributeError: 'module' object has no attribute 'connect'
模块是否正确安装,若是已经安装
检查py文件名和模块名重复
pymysql.err.OperationalError: (1044, "Access denied for user 'guest'@'%' to database 'test'")
一般是connect中的参数有误
pymysql.err.OperationalError: (1045, "Access denied for user 'guest'@'192.168.0.103' (using password: YES)")