GnuCash
offers several formats for storing your financial data. The default file storage format is
XML, while SQL storage is available in SQLite, MySQL,
and PostgreSQL formats. Users can choose a file format for new files from
→
and for existing files from
→
dialogs.
The XML storage format is a text file that by default is compressed, which is a preference that is set at General Compress files. SQLite storage is also available, and stores your data in a single file on your system, like the XML format. However, internally, an SQLite file is managed as a database. The MySQL and PostgreSQL storage options require access to a MySQL or PostgreSQL database server and the installation of additional database drivers on your machine.
→Tip | |
---|---|
Users can change the format at any time by using → . This will create a copy of the data file in the selected format. |
Each storage format has benefits and shortcomings that users should consider for their needs and abilities. See the Storage Comparison below for further details.
The XML format is the most stable and established, and for this reason, it is recommended for most users. SQL storage was added for the 2.4 release and has become an increasingly popular choice for users. The SQLite format allows users to realize the benefits of SQL storage without the overhead of installing or managing a full DBMS. MySQL and PostgreSQL require the installation of MySQL and PostgreSQL DBMS, respectively, and are best maintained only by experienced database administrators.
Note | |
---|---|
Use of a SQL back end for storage implies to many that |
Table 2.2. Storage Comparison
XML | SQLite | MySQL | PostgreSQL | |
---|---|---|---|---|
Availability | Built-in | Depends on packaging [a] | ||
File extension | gnucash | N/A [b] | ||
Additional software | None | MySQL | PostgreSQL | |
Additional expertise | None | Database Administrator | ||
Compression | gzip | N/A | ||
File Save | On command | On commit | ||
Multi-user | No | No | No | No |
[a] The SQL backends rely on additional packages. These are included in the macOS and Microsoft Windows application bundles and installed automatically by GnuCash's flatpak installer. Linux distribution users may need to explicitly install the one they want with their package manager. Look for a package named something like libdbd-sqlite3, libdbd-mysql, or libdbd-pgsql for SQLite3, MySql, and Postgresql respectively. [b] MySQL and PostgreSQL place data within their own storage system. |
To create a new GnuCash
file do the following:
From the GnuCash
Menubar, choose
→
. The New Account Hierarchy setup assistant will start.
Note | |
---|---|
If you are running |
Set your preferences in the assistant and move through the screens with the
, and buttons.Follow these steps to save the file under your preferred name:
Choose
Menubar or select the
Toolbar button. GnuCash
will bring up the save window.
Select the Data Format of the file you are saving from the drop down list. The default selection is xml but if you have set up a database back end you can change to that format.
Depending on the selected Data Format the window can change as described in the following.
If you selected xml or sqlite3 you will see a screen like this:
Type your chosen filename in the Name field. It is not necessary to specify an
extension when you write the file name. GnuCash
will automatically add the extension
.gnucash
to the file.
Note | |
---|---|
The |
Select the path where the file will be saved by browsing the tree in the lower panes.
Tip | |
---|---|
Click on the button to create a new folder with a custom name in the selected path. |
If you selected mysql or postgres Data Format, you will see a screen like this:
Enter in this window the Database Connection information: Host, Database, Username and Password.
Warning | |
---|---|
Saving to mysql or postgres requires the proper permissions in that database, that is you need to have the permissions to create a new database with the given database name, or you need to have write access to an existing database with the given database name. |
Click the
button to save the file.If you are keeping track of finances for a single household, you need only one file. But if you are also tracking business finances or want to keep data separate for some reason, then you will need more than one file.
Before ending each GnuCash
session, be sure to save your data changes using
→
or the Toolbar button.
Note | |
---|---|
As it is very important to save your data frequently to avoid losing them for whatever reason, |
To open an existing file or database, select Data Format. If you selected File choose the file you want to open by browsing the folders in the lower panes. Else, enter the required Database Connection information.
→ from the menu. In the window that will open, select theTip | |
---|---|
|
In some cases, it might be useful to duplicate the structure of an existing data file in a new file. For example, you might want to try out new accounting techniques without corrupting your actual accounting data, or you might need to follow accounting guidelines that require you to close your books at the end of the year and begin each year with a fresh set of books.
GnuCash
allows you to create an empty copy of your Chart of Accounts simply by selecting
→ →
. When you select this command, you are asked to provide the name for the new empty file,
and GnuCash
creates a new data file that contains only your account hierarchy (that is, there
is no transaction data). Once saved, the new file can be opened like any other GnuCash
data
file as described above.