From ec8c40f001ebb348a352a83408d4f1952b54ab04 Mon Sep 17 00:00:00 2001 From: Nathan Steel Date: Thu, 9 Jun 2022 09:11:02 +0100 Subject: [PATCH] Add basic DB guide articles --- blog/adminer-setup.html | 85 +++++++++++++++++++++++++++++++ blog/backup-mysql-mariadb.html | 52 +++++++++++++++++++ blog/guide-to-server-hosting.html | 15 +++--- blog/index.html | 4 ++ blog/install-mysql-mariadb.html | 68 +++++++++++++++++++++++++ blog/sql-cheatsheet.html | 75 +++++++++++++++++++++++++++ 6 files changed, 292 insertions(+), 7 deletions(-) create mode 100644 blog/adminer-setup.html create mode 100644 blog/backup-mysql-mariadb.html create mode 100644 blog/install-mysql-mariadb.html create mode 100644 blog/sql-cheatsheet.html diff --git a/blog/adminer-setup.html b/blog/adminer-setup.html new file mode 100644 index 0000000..258995d --- /dev/null +++ b/blog/adminer-setup.html @@ -0,0 +1,85 @@ + + + + + + + + + + + + + Adminer Setup + + + +
+

Adminer Setup

+
+ +
+
+ +
+
+

Adminer is a simple front-end for your database server that can be access through the browser

+

Pre-Requirements

+

To run adminer, you'll need a webserver with php set up. Thankfully I'm a great guy, and have written about these topics before.

+ + +

Download the latest release

+

This will download the latest release to your default web directory, this can be changed, by altering the path following -O.

+
wget "http://www.adminer.org/latest.php" -O /var/www/html/adminer.php
+ +

Set permissions for your web server

+
chown -R www-data:www-data /var/www/html/adminer.php
+chmod 755 /var/www/html/adminer.php
+ +

Access it

+

Head to your /adminer.php, and you should load into the adminer login. Using your mysql/mariaDB credentials, you can then login, and use the GUI to manage your database(s)

+ +

Make it a directory, not a file

+

Instead of accessing /adminer.php?, we can make it look like /adminer/

+
location /adminer/ {
+	root /var/www/html ;
+	try_files $uri $uri/ /adminer/index.php/$is_args$args ;
+}
+ +

Password Protect

+

An additional level of security, just in case. Using Htaccess, any file, or directory can be password protected

+
sudo apt install apache2-utils
+htpasswd -c /home//.htpasswd admin
+ +

Add to location

+

Add the location of the auth file to the adminer location block

+
auth_basic "Adminer" ;
+auth_basic_user_file /home//.htpasswd ;
+

They block should look like below

+
location /adminer/ {
+	auth_basic "Adminer" ;
+	auth_basic_user_file /home//.htpasswd ;
+	root /var/www/html ;
+	try_files $uri $uri/ /adminer/index.php/$is_args$args ;
+}
+ +
+
+ + + + + diff --git a/blog/backup-mysql-mariadb.html b/blog/backup-mysql-mariadb.html new file mode 100644 index 0000000..65f8b02 --- /dev/null +++ b/blog/backup-mysql-mariadb.html @@ -0,0 +1,52 @@ + + + + + + + + + + + + + Backup MySQL/MariaDB + + + +
+

Backup MySQL/MariaDB

+
+ +
+
+ +
+
+

A database if a huge part of many projects, services, and servers. If something goes wrong, data is wrongly updated/deleted there could be many problems. Thankfully we can make backups to make sure our data is safe.

+

Manual Backup of a DB

+ +

Backup all DBs

+

This follows on from the manual backup, so assumes you have the backup directory created

+

Automate hourly backups

+ +

My backup script

+

I follow the 3-2-1 backup approach, so I want to keep the files in multiple locations

+ +
+
+ + + + + diff --git a/blog/guide-to-server-hosting.html b/blog/guide-to-server-hosting.html index 72a5ecc..17e6beb 100644 --- a/blog/guide-to-server-hosting.html +++ b/blog/guide-to-server-hosting.html @@ -50,23 +50,23 @@
  • Setup an nginx website
  • Add an SSL certificate w/Certbot
  • TODO: Nginx web optimisation
  • -
  • TODO:Add PHP to your webserver (optional)
  • +
  • TODO:(Optional) Add PHP to your webserver
  • TODO:Guide to web-development
  • MariaDB Database

    A database is a great tool to store, access, and filter data. Typically used alongside a website, or other services, but can be useful standalone if you know what you're doing

    Backup your server!

    Backups are super useful. If something breaks, or gets accidentally deleted you can always use a backup to get it back

    @@ -81,7 +81,7 @@

    Proxy services to port 80/433

    -

    Many services you install will be accessible via the web, but will use a different ports. Proxying these allows access (and security) without the need to append a port to the server address

    +

    Many services you install will be accessible via the web, but will use different ports. Proxying these allows access (and security) without the need to append a port to the server address, and without directly allowing access to the service from outside the server.

    Additional services/potential guides

    Unless there is an anchor, these are all "TODO", and may just be omitted from this guide

    @@ -101,6 +101,7 @@
  • VPN
  • mailserver
  • cockpit for noob-friendly server management
  • +
  • Basic Homeserver for a web developer/designer
  • diff --git a/blog/index.html b/blog/index.html index fc13cac..54317ad 100644 --- a/blog/index.html +++ b/blog/index.html @@ -38,6 +38,10 @@

    2022