Sqlite 错误:文件不是数据库 [英] Sqlite Error: file is not a database

查看:142
本文介绍了Sqlite 错误:文件不是数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个名为 database.db

I have created a database named database.db

在数据库中创建表时出现错误:Error: file is not a database

When I create a table in the database I get the error:Error: file is not a database

nehal@nehal-Inspiron-5559:~/Desktop/UAV$ sqlite3 database.db 
SQLite version 3.20.1 2017-08-24 16:21:36
Enter ".help" for usage hints.
sqlite> CREATE TABLE users(
   ...> password varchar(10),
   ...> email text,
   ...> name text
   ...> );
Error: file is not a database

我该如何解决错误?

推荐答案

创建没有 .db 扩展名的数据库.
例如sqlite3 users//这会创建一个名为users的数据库

Create database without the .db extension.
for e.g. sqlite3 users //this creates a database names users

这篇关于Sqlite 错误:文件不是数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆