It shows you how to run BaseX in client-server mode from a terminal. You can copy and paste all commands to get them running on your machine. After you finished this tutorial, you will be familiar with the basic administration of BaseX. Visit the [[Commands|commands section]] for a complete list of database commands.
First, launch a '''Server''' and '''Client''' instance of BaseX: double click on the '''BaseX Server/Client''' icons, or run the <code>basexserver</code> and <code>basexclient</code> scripts. [[Startup#BaseX Server|Follow this link]] for more information (or check out the additional [[Command-Line Options#BaseX Server|command-line options]]).
==Create a database ==
* To create a database you need an XML document, e.g. [http://files.basex.org/xml/factbook.xml factbook.xml].
Depending on your [[Configuration]], the location of your home folder varies. For example, on a Mac it's <code>/Users/John</code>, if your name is John. If you have used the Windows Installer, the directory will be named <code>data</code>, and reside in the application directory.
==Execute a query ==
The [[Commands#XQUERY|XQUERY]] command lets you run a query.
* For example, this query returns all country nodes in the currently opened database.
==Create a new database ==
Now we will create another database from the [http://files.basex.org/xml/xmark.xml xmark.xml] document.
==Switch the database ==
* You can explicitly query the factbook database with the <code>doc(...)</code> funtion, no matter what the current context is.
==Close or delete a database ==
* To [[Commands|close]] the current context database, please type:
==Create a collection ==
'''What is a collection?'''
With BaseX you can group documents into one logical collection. A collection is a database that contains two or more documents. Collections accept any type of XML documents, regardless of their structure.
==Delete a document ==
* Deleting a document from a collection is easy:
Make sure that the collection, which contains the '''xmark.xml''' document, is opened.
==Delete a collection ==
Deleting a collection is the same as deleting a database.
==Get server information ==
Several commands help to explore the state of a server. For a complete list, please visit the [[Commands]] Section.
==Backup and restore ==
* To backup your database, type:
To restore the database the file with the newest timestamp is taken.
==See also ==
[[Standalone Mode]], [[GUI]], [[Getting Started]], [[Advanced Usage]]