In my Firefox profile directory there is a cookies.sqlite
file which holds the data for Firefox's cookies. I grabbed the Firefox SQLite Manager extension and loaded this file, which works, but how can I use plain query commands to read the cookies out of that file?
This is what I've tried so far:
$ sqlite3 cookies.sqlite
sqlite> SELECT * FROM dbname.sqlite_master WHERE type='table';
SQL error: file is encrypted or is not a database
I can't even list the tables, so I'm not able to start trying to list the cookies yet. If I can connect I'd like to be able to read and write data there, but I'm new to SQLite.
I had the same problem trying to read the cookies.sqlite file on Mac OS 10.6.8 (Snow Leopard). I downloaded SQLite 3.7.10 from http://www.sqlite.org/download.html and then I could open the file.
Here's a walkthrough of what I did...
sqlite3
binary from the downloads folder to the terminal window, this should enter the path to sqlite3
onto the command line.If all goes well you should get the sqlite> command prompt. If you enter .tables you should see the table moz_cookies, which you can then query and investigate further.
The following commands might help:
.mode column
.headers on
select * from moz_cookies where domain = '.stackoverflow.com';
You should see all the values stored in your cookie for this site.
If you want to update the existing sqlite3 on your Mac, I did sudo mv /usr/bin/sqlite3 /usr/bin/sqlite3.old
(just in case of any future problems, I can move it back again) and then sudo mv ~/downloads/sqlite3 /usr/bin/sqlite3
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With