今天创建一个MYSQL数据库时遇到的一个小问题:
create table booktype
(
btid int(5) unsigned zerofill auto_increment not null primary key,
btname varchar(100) not null unique,
btnote text
);
create table books
(
bid int(5) unsigned zerofill auto_increment not null primary key,
bname char(30) not null,
isbn char(50) not null,
author char(30) not null,
press text,
summary text,
bcount int not null default 0,
btid int,
foreign key(btid) references booktype(btid)
);
出现的报错:
ERROR 1005 (HY000): Can't create table '.\bookdata\books.frm' (errno: 150)
主要问题是:
foreign key(btid) references booktype(btid) 中books表的 btid 是int和booktype表中的btid设置的关联字段类型不匹配,books表中btid改正成:btid int(5) unsigned zerofill ,就不会报错了,创建表和修改表地时候常常一步小小就忘记了这个.
分享到:
相关推荐
下面看看这个问题: Can’t open file: ‘×××.MYI’ (errno: 145),这个错误一般就是你的数据库表文件损坏造成的,造成的原因大概是你把数据库文件挪来挪去的结果,当然不排除其他原因啊。 具体数据库出现错误的...
个错误是典型的mysql表受损造成的,解决的办法就是修复表,这个问题也是mysql经常容易出现的,mysql表和索引损坏的几率很大,但是修复也很方便
在很多实例中,这种错误的发生都是因为mysql一直以来都不能很好的支持的关系的问题, 更不幸的是它也并没有指明到底是哪一个问题会导致上面那种错误,下面我把导致这个可怕 的150错误的常见原因列出来了,并且我以...
Last_SQL_Error: Error ‘Table ‘spider.tb_city_population_rank’ doesn’t exist’ on query. Default database: ‘spider’. Query: ‘alter table tb_city_population_rank discard tablespace’ Last_SQL_...
如图,用管理员运行,在命令行窗口输入mysqld --initialize --console,执行初始化命令,出现了mysqld: Can’t create directory ‘D: ystem tool\mysql-8.0.19-winx64\Database’ (OS errno 2 – No such
最近遇到Mysql主从同步的Last_IO_Errno:1236错误问题,然后在网上查找相关解决方案,这里分享给大家,供参考。
本篇文章是对MySQL创建外键关联错误-errno:150进行了详细的分析介绍,需要的朋友参考下
关键字描述:错误 MySQL 问题 NOT NULL 数据库 安装 unsigned tinyintPHPCMS2008安装...MySQL Query : CREATE TABLE `phpcms_admin` ( `userid` mediumint(8) unsigned NOT NULL, `username` char(20) NOT NULL, `allow
SQL_Server_2005范例代码查询辞典
错误提示:Error: Can’t create/write to file ‘C:\WINDOWS\TEMP\#sql_738_0.MYD’ (Errcode: 17) Errno.: 1 问题分析: 1、C:\Windows\TEMP 文件夹权限不够,至少也要给出 USERS 组的可读可写权限; 2、C:\...
今天,搭建新购的阿里云ECS环境(ubuntu 16.04 LTS),需要将mysql的数据保存在新挂载的磁盘上(已挂载到/mnt下),先停掉mysql服务,然后查看mysql并数据保存的位置:vi /etc/mysql/mysql.conf.d/mysqld.cnf发现...
couldn’t remove fs lock errno:9 Bad file descriptor 此时需要修改文件所有者 $ sudo mkdir -p /data/db/ $ sudo chown ‘USERNAME‘ /data/db 其中第一句是建立你的数据库文件夹,第二句修改该文件夹的所有者 ...
在MySQL里创建外键时,提示错误,但只提示很简单的信息:ERROR 1005 (HY000): Can’t create table ‘db_qxztc.qx_userssssnew’ (errno: 150)。根本起不到解决问题的作用。 要看错误的详细提示,可以使用命令:(在...
Last_Errno: 1062,Last_Error: Error Duplicate entry ... for key PRIMARY
如何解决python.exe: can’t open file ‘manage.py’: [Errno 2] No such file or directory这个问题 #本文章是记录我在开发一个基于python django的项目中的一些问题。本人新手小白,请多包涵。 使用pycharm新建一...
ERROR 1135 (HY000): Can’t create a new thread (errno 11);if you are not out of available memory,you can consult the manual for a possible OS-dependent bug 第一反应感觉可能是跟ulimit限制连接数有关,...
使用PHP访问MySQL数据库 -----连接数据库 连接数据库 ...课程内容 一、连接数据库 ...if(MySQLi_connect_errno()) { echo'Error:could not connect to DB.Please try again later.' exit; } MySQL的max_connection
本篇文章是对mysql数据库还原错误:(mysql Error Code: 1005 errno 121)的解决方法进行了详细的分析介绍,需要的朋友参考下