从 Mac 终端编辑 sqlite 文件
我找不到任何可以打开我从 Mac 终端创建的现有 sqlite 数据库文件的文档。我想向现有数据库添加一些额外的行。我可能会寻找错误的东西,所以任何为我指明正确方向的东西都会受到极大的赞赏。
I can not find any documents where I can open existing sqlite database file that I made from the terminal on Mac. I want to add some additional rows to the existing database. I probably search for the wrong things, so anything that points me in the right direction is much appriciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您想保留在终端中,可以使用命令
sqlite3 [databasename]
打开 sqlite3 数据库。从这里,您可以使用 SQL 命令选择行或插入新行。如果您更喜欢 GUI,有很多可供选择,包括免费的 Firefox 插件 sqlite-manager。If you want to remain in the Terminal, you can open a sqlite3 database using the command
sqlite3 [databasename]
. From here, you can select rows or insert new ones using SQL commands. If you prefer a GUI, there are many to choose from, including the free Firefox plugin, sqlite-manager.每当您使用Mac内置的sqlite3时,它都会将文件保存在终端所在的当前文件夹中,并且您访问它们的方式是相反的,当您位于数据库所在的文件夹时打开sqlite3。
Whenever you work with Mac built-in sqlite3 it saves the files in the current folder where your Terminal is and the way you can access them is the reversed story, open sqlite3 while you are at the folder where your database is.
查找并获取OSX 的预编译二进制文件。
使用命令行客户端。
Find and get precompiled binaries for OSX.
Use the command line client.
我意识到这与问题有点无关,但能够在 Finder 中查找/移动隐藏文件很有帮助,因为 sqlite DB 通常会出现在隐藏文件夹中。请参阅:
http://www.macworld.com/article/1051830/showallfinder.html
关键是在终端中输入此内容,然后强制 Finder 重新启动(通过 Apple 菜单的 Force Quit on Lion):
最后将其更改为 NO 以将其关闭。
I realize this is a bit tangential to the question, but it's helpful to be able to find/move hidden files in Finder, because often sqlite DBs will wind up in a hidden folder. See:
http://www.macworld.com/article/1051830/showallfinder.html
The key bit is to enter this in the Terminal, then force Finder to relaunch (via the Apple menu's Force Quit on Lion):
Change that to NO at the end to toggle it off.