{"id":1176,"date":"2022-03-14T14:44:32","date_gmt":"2022-03-14T06:44:32","guid":{"rendered":"https:\/\/www.cith.ml:5444\/?p=1176"},"modified":"2023-09-04T20:18:28","modified_gmt":"2023-09-04T12:18:28","slug":"subsonic-using-an-external-database","status":"publish","type":"post","link":"https:\/\/blog.cithwu.com\/wp5444\/subsonic-using-an-external-database\/","title":{"rendered":"Subsonic Using an External Database"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">By default, Subsonic uses an in-process HSQLDB database which requires no setup or maintenance. Starting with Subsonic&nbsp;6.1, advanced users have the option to use an external database instead. The following databases are supported:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/dev.mysql.com\/downloads\/\">MySQL<\/a> (tested with version 5.6 and 5.7)<\/li>\n\n\n\n<li><a href=\"https:\/\/www.postgresql.org\/download\/\">PostgreSQL<\/a> (tested with version 9.6)<\/li>\n\n\n\n<li><a href=\"https:\/\/mariadb.org\/download\/\">MariaDB<\/a> (tested with version 10.1)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Setup<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Make sure you are using Java 8.<\/li>\n\n\n\n<li>Install MySQL\/PostgreSQL\/MariaDB, or use an existing database server.<\/li>\n\n\n\n<li>Create an empty database called &#8220;subsonic&#8221;.<\/li>\n\n\n\n<li>Set the JDBC URL of the database as a start-up option to Subsonic (see below).<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">JDBC URL<\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>MySQL \/ MariaDB<\/td><td><code>jdbc:mysql:\/\/localhost:3306\/subsonic?user=root&amp;password=mysecretpassword&amp;characterEncoding=UTF-8<\/code><\/td><\/tr><tr><td>PostgreSQL<\/td><td><code>jdbc:postgresql:\/\/localhost:5432\/subsonic?user=postgres&amp;password=mysecretpassword<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Remember to change hostname, port, user and password according to your installation.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Start-up option<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The JDBC URL must be given as a start-up option. This is done differently depending on how you installed Subsonic.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Windows<\/td><td>Add <code>-Dsubsonic.db=&lt;JDBC URL&gt;<\/code> in <strong>C:\\Program Files (x86)\\Subsonic\\subsonic-service.exe.vmoptions<\/strong><\/td><\/tr><tr><td>Mac<\/td><td>Add <code>-Dsubsonic.db=&lt;JDBC URL&gt;<\/code> in <strong>\/Applications\/Subsonic.app\/Contents\/Info.plist<\/strong><\/td><\/tr><tr><td>Linux<\/td><td>Add <code>--db=&lt;JDBC URL&gt;<\/code> to SUBSONIC_ARGS in <strong>\/etc\/default\/subsonic<\/strong> (Ubuntu\/Debian) or <strong>\/etc\/sysconfig\/subsonic<\/strong> (Fedora\/RPM).<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u4f7f\u7528 mariadb  URL\u9700\u8981\u8fd9\u91cc\u6539\u4e00\u4e0b   jdbc:mariadb:\/\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Migration<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Please note that there is no automatic data migration from HSQLDB to MySQL\/PostgreSQL\/MariaDB.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By default, Subs&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,9],"tags":[],"class_list":["post-1176","post","type-post","status-publish","format-standard","hentry","category-linux","category-9"],"_links":{"self":[{"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/posts\/1176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/comments?post=1176"}],"version-history":[{"count":4,"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/posts\/1176\/revisions"}],"predecessor-version":[{"id":1311,"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/posts\/1176\/revisions\/1311"}],"wp:attachment":[{"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/media?parent=1176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/categories?post=1176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.cithwu.com\/wp5444\/wp-json\/wp\/v2\/tags?post=1176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}