Site updated at 2017-10-02 12:26:10 UTC

This commit is contained in:
Travis CI 2017-10-02 12:26:11 +00:00
parent c0f6082634
commit c4dfa10e02
27 changed files with 91 additions and 80 deletions

View file

@ -153,6 +153,14 @@
<td style="text-align: left">SQLite</td>
<td style="text-align: left"><code class="highlighter-rouge">sqlite:///PATH/TO/DB_NAME</code></td>
</tr>
<tr>
<td style="text-align: left">MariaDB</td>
<td style="text-align: left"><code class="highlighter-rouge">mysql://SERVER_IP/DB_NAME</code></td>
</tr>
<tr>
<td style="text-align: left">MariaDB        </td>
<td style="text-align: left"><code class="highlighter-rouge">mysql://user:password@SERVER_IP/DB_NAME</code>      </td>
</tr>
<tr>
<td style="text-align: left">MySQL</td>
<td style="text-align: left"><code class="highlighter-rouge">mysql://SERVER_IP/DB_NAME</code></td>
@ -185,18 +193,21 @@
</table>
<h2><a class="title-link" name="installation-notes" href="#installation-notes"></a> Installation notes</h2>
<p>Not all Python bindings for the chosen database engine can be installed directly. This section contains additional details which should help you to get it working.</p>
<h3><a class="title-link" name="mysql" href="#mysql"></a> MySQL</h3>
<h3><a class="title-link" name="maridb-and-mysql" href="#maridb-and-mysql"></a> MariDB and MySQL</h3>
<p>For MariaDB you may have to install a few dependencies. On the Python side we use the <code class="highlighter-rouge">mysqlclient</code>:</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>sudo apt-get install libmariadbclient-dev
<span class="gp">$ </span>pip3 install mysqlclient
</code></pre>
</div>
<p>For MySQL you may have to install a few dependencies. You can choose between <code class="highlighter-rouge">pymysql</code> and <code class="highlighter-rouge">mysqlclient</code>:</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>sudo apt-get install libmysqlclient-dev
<span class="gp">$ </span>pip3 install mysqlclient
</code></pre>
</div>
<p>If you are in a virtual environment, dont forget to activate it before installing the pymysql package.</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>pi@homeassistant:~ <span class="nv">$ </span>sudo -i
<span class="gp">root@homeassistant:~# </span>su homeassistant
<span class="gp">homeassistant@homeassistant:/root$ </span><span class="nb">cd</span> /srv/homeassistant/homeassistant_venv/
<span class="gp">homeassistant@homeassistant:/srv/homeassistant/homeassistant_venv$ </span><span class="nb">source </span>bin/activate
<span class="o">(</span>homeassistant_venv<span class="o">)</span> homeassistant@homeassistant:/srv/homeassistant/homeassistant_venv<span class="nv">$ </span>pip3 install mysqlclient
<p>If you are in a virtual environment, dont forget to activate it before installing the <code class="highlighter-rouge">mysqlclient</code> Python package.</p>
<div class="language-bash highlighter-rouge"><pre class="highlight"><code>pi@homeassistant:~ <span class="nv">$ </span>sudo su homeassistant -s /bin/bash
<span class="gp">homeassistant@homeassistant:~$ </span><span class="nb">source</span> /srv/homeassistant/bin/activate
<span class="o">(</span>homeassistant<span class="o">)</span> homeassistant@homeassistant:~<span class="nv">$ </span>pip3 install mysqlclient
</code></pre>
</div>
<p>After installing the dependencies, it is required to create the database manually. During the startup, Home Assistant will look for the database specified in the <code class="highlighter-rouge">db_url</code>. If the database doesnt exist, it will not automatically create it for you.</p>