Troglaptop: install MariaDB

This commit is contained in:
Philip Sargent
2022-06-25 15:54:54 +03:00
parent 546b62fc59
commit e350ebc776
2 changed files with 44 additions and 2 deletions

View File

@@ -65,7 +65,7 @@ See the live report on which urls resolve to which actual folders at <a href="/p
<ul>
<li><b>apache webserver *</b>
<li><b>expofiles *</b>
<li><b>MySQL/MariaDB database *</b>
<li><b>MySQL/MariaDB database *</b> <var>sudo apt install mariadb-server -y </var>
<li><a href="#xapian">xapian</a> (search function) - <a href="https://xapian.org/">xapian.org</a>. Wookey did this in 2020.
<li><a href="#kanboard">kanboard</a> (task planning) - <a href="https://kanboard.org/">kanboard.org</a>. Wookey did this in 2022.
<li><a href="#boe">boe</a> (bank of expo - not troggle)

View File

@@ -409,8 +409,50 @@ Nearly half the code deals with importing and parsing data, so you need to test
<img class="onright" width = "80px" src="https://sqlite.org/images/sqlite370_banner.gif">
<p>The public server uses a <a href="https://mariadb.org/about/">MariaDB SQL database</a> and development is usually done using a single-user <a href="https://sqlite.org/about.html">sqlite database</a> which is a standard Django option.
<p>
You will find it very, very useful to see what is going on if you look directly at the data in the database (just a single file in the sqlite case) and browse the data in the tables. This is vital when doing Django migrations between Django versions. A light-weight, simple db browser is <a href="https://sqlitebrowser.org/">DB Browser for SQLite</a>. Connecting directly the the MariaDB database with a control panel or <a href="https://www.mysql.com/products/workbench/">workbench</a> gives even more tools and documentation capabilities. See the <a href="serverconfig.html">troggle server documentation</a> for how to install MariaDB.
You will find it very, very useful to see what is going on if you look directly at the data in the database (just a single file in the sqlite case)
and browse the data in the tables. This is vital when doing Django migrations between Django versions. A light-weight, simple db browser is <a href=
"https://sqlitebrowser.org/">DB Browser for SQLite</a>. Connecting directly the the MariaDB database with a control panel or <a href=
"https://www.mysql.com/products/workbench/">workbench</a> gives even more tools and documentation capabilities. See the <a href="serverconfig.html">
troggle server documentation</a> for how to install MariaDB.
<p>When Ubuntu is running on WSL, it does not use systemctl. So you need specific instructions for installing MariaDB under WSL,
see
<ul>
<li><a href="https://segmentfault.com/a/1190000040671057/en">Ubuntu-20.04 (WSL) install MySQL (MariaDB)</a>.
<li><a href="https://stackoverflow.com/questions/52487644/install-mariadb-in-windows-subsystem-linux-wsl">
Install MariaDB in Windows subsystem Linux (WSL)</a> (if you have complications)
</ul>
<p>Create a new dedicated administrative MariaDB user 'expo' who can access all databases. Log in to the MariaDB command with
<pre>sudo mysql
</pre>
and execute these commands:
<pre>
GRANT ALL PRIVILEGES on *.* TO 'expo'@'%' IDENTIFIED BY 'my-secret-password-schwatzmooskogel' WITH GRANT OPTION;
SET PASSWORD FOR expo=PASSWORD('my-secret-password-schwatzmooskogel');
FLUSH PRIVILEGES;
QUIT;
</pre>
and you will need to set this user and password in your <var>localsettings.py</var>:
<pre>
DATABASE = {
'default': {
'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME' : 'troggle', # Or path to database file if using sqlite3.
'USER' : 'expo',
'PASSWORD' : 'my-secret-password-schwatzmooskogel',
'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
'PORT' : '', # Set to empty string for default. Not used with sqlite3.
}
}
</pre>
<h4>But it still does not work</h4>
<p>That is because we need to install the python tools that talk to mariadb.
<pre>
pip install mariadb
</pre>
but note that there is a problem with using python 3.10 in that some bits of pip are not correct and you will get a
<var>ImportError: cannot import name 'html5lib'</var> error.
[Currently under investigation, June 2022]
<hr />
Go on to: <a href="trogarch.html">Troggle architecture</a><br />