SQLite User Forum

Trying to "Open Database" Safari History.db file and get Error: "could not open safari database file reason: unable to open..
Login

Trying to "Open Database" Safari History.db file and get Error: "could not open safari database file reason: unable to open..

(1) By DallasGrl (dallasgrl) on 2021-08-19 20:48:48 [source]

I am not very technical but trying to use this software to open a Safari History.db file to recover Safari Browsing History. Note that I tried Time Machine and it would not work for me. :(

When I try to Open the file, I get this error message:

could not open safari database file reason: unable to open database file

I tried copying the file to my desktop and naming it History1.db (and it shows it's 7.7 MB) and was able to open it, and I can see the Database Structure files, but when I hit "Browse Data" there is no detail. It only shows one line item with a bunch of numbers in it.

Does anyone have any tips for me to open the original file?

Thanks so much!! -Kim

(2) By Keith Medcalf (kmedcalf) on 2021-08-19 21:42:34 in reply to 1 [link] [source]

First problem sounds like you have a problem with spaces in the filename.

The second issue sounds like, although there is a sign over the road that says "Browse Data", when you throw a baseball at that sign, no "Browse Data" occurs.

This should be taken up with the sign-maker in order to determine the proper way to hit the "Browse Data" sign in order to "Browse Data". Since no one here put up the sign it is unlikely that anyone here will be able to help you.

(3) By Simon Slavin (slavin) on 2021-08-20 13:04:50 in reply to 1 [link] [source]

trying to use this software

The SQLite team made only one piece of software a non-programmer would use. It's very technical, and it's unlikely you used it. On a Mac you would have to be running Terminal.app to get at it.

I'm guessing you used SQLite Browser or something like that. Those programs are written by other people and the SQLite team can't support them. SQLite itself does not have error messages like 'unable to open database file'.

Can I ask why you're not using Safari to look at your Safari history ? That would seem the obvious way to do it. If I know why that isn't working I might be able to help.

Also, do you have the pages you need bookmarked, or just in your history ?

(4) By anonymous on 2021-12-16 23:17:07 in reply to 3 [link] [source]

I'm really interested in how to open this file. I have huge Safari history. Last year, I followed classes in a foreign country, and had an e-class system with all my projects, classes supports... I cannot access to the e-class specific web pages from my login page (which I still have access to). But I figured accessing it through the web page by the History URL opens to the exact files, and even video recordings, exactly what I'm looking for. I'd like to filter my history with those criteria, and be able to recover all my classes, which were very interesting :)

(9.1) By Simon Slavin (slavin) on 2021-12-17 17:14:25 edited from 9.0 in reply to 4 [link] [source]

Works find for me when I use the Command Line Shell provided by the sqlite3 team.

Quit Safari. Copy the History.db file somewhere else. (You can restart Safari now if you want.) Open the copy you made with the sqlite3:

simon@183 Desktop % sqlite3 History.db
SQLite version 3.36.0 2021-06-18 18:58:49
Enter ".help" for usage hints.
sqlite> .mode table
sqlite> SELECT * FROM history_items LIMIT 3;
+--------+---------------------------------------+------------------+-------------+--------------------+---------------------+-----------------------+---------------------------------------+-------------------+-------------+
|   id   |                  url                  | domain_expansion | visit_count | daily_visit_counts | weekly_visit_counts | autocomplete_triggers | should_recompute_derived_visit_counts | visit_count_score | status_code |
+--------+---------------------------------------+------------------+-------------+--------------------+---------------------+-----------------------+---------------------------------------+-------------------+-------------+
| 201295 | https://slashdot.org/                 |                  | 7197        | ?                  | a???                |                       | 1                                     | 5100              | 0           |
| 201315 | https://news.ycombinator.com/         | news.ycombinator | 4837        | ?                  |                     |                       | 1                                     | 5100              | 0           |
| 201321 | https://www.reddit.com/               | reddit           | 11152       | }                  | `	             |                       | 0                                     | 5920              | 0           |
+--------+---------------------------------------+------------------+-------------+--------------------+---------------------+-----------------------+---------------------------------------+-------------------+-------------+
sqlite> .quit

(5) By Rowan Worth (sqweek) on 2021-12-17 03:24:48 in reply to 3 [link] [source]

SQLite itself does not have error messages like 'unable to open database file'.

sqlite3.c:144789:    /* SQLITE_CANTOPEN    */ "unable to open database file",

(6) By Simon Slavin (slavin) on 2021-12-17 16:48:49 in reply to 5 [link] [source]

That's not an error message. It's a comment to a line in a C program.

(7) By Warren Young (wyoung) on 2021-12-17 16:51:44 in reply to 6 [link] [source]

(8) By Simon Slavin (slavin) on 2021-12-17 17:07:42 in reply to 7 [link] [source]

You're right. Thanks for the correction.

(10) By anonymous on 2022-01-24 19:19:26 in reply to 1 [link] [source]

Hi Kim. I'm currently working with the Safari history.db file myself and came across this page. Here are a couple of suggestions:

(1) Are you using DB Browser for SQLite to browse the database? If not you should :) Info and downloads: https://sqlitebrowser.org
(2) >> when I hit "Browse Data" there is no detail. It only shows one line item with a bunch of numbers in it << I think you're looking at the history_client_version table within history.db. Open your database using DB Browser for SQLite, click the "Table: " dropdown and select another table. The history_visits table (maybe also the history_items table) probably has the data you are looking for. 
(3) If you want to work with your original history.db instead of having to make a copy, you need to give DB Browser for SQLite full disk access. Go to System Preferences > Security & Privacy (click the lock to make changes) > select Full Disk Access and check the box next to DB Browser for SQLite.

Hope this is helpful :)