This page is a scrubbed, public-safe version of an internal AI/SI operations runbook — the
command cheat-sheet a systems engineer builds up over years of running Linux servers,
virtualisation hosts, firewalls, databases, certificates and Raspberry Pi devices.
It is organised into the same sections as the original workbook, one page each — reach any of
them from the AI/SI Prompts menu above. Every
task on this page shows three things:
A description — what the task achieves and which tools it uses.
The commands — the actual snippet, exactly as recorded, with every
credential, token, licence key and internal host name or IP replaced by a
<PLACEHOLDER>.
An AI prompt — a ready-to-paste instruction that asks an AI assistant to
regenerate that snippet as a clean, parameterised, re-runnable script.
The point of the AI-prompt column is to show how a pile of accumulated tribal knowledge can
be turned into something an assistant can reproduce and improve on demand: you keep the intent,
and let the model rewrite the mechanics for whatever host you are on today. Nothing on this
page should be run without reading it first — several snippets are destructive
(dd, rm -rf, postsuper -d ALL, firewall reloads).
MySQL connection details
The connection parameters for the reference MySQL instance — user, host and database. The password is redacted; the other snippets in this section use these values.
Commands
root
# Password:
<DB_PASSWORD> % denotes every database in GRANT statements
# Host:
<INTERNAL_IP> <INTERNAL_IP>.0.0.0 For subnets use: <INTERNAL_IP>.0.0.0.
# Database:
vtx
AI prompt
Generate a Bash script for the task “MySQL connection details”. Produce a .env template plus a shell function that loads MySQL host, user, password and database from the environment and opens a mysql session. Assume CentOS/RHEL or Raspberry Pi OS as appropriate, comment each step, and never hard-code a real credential — read secrets from the environment.
Change years to current year
An ad-hoc SQL query kept for reuse — here, shifting stored dates to the current year.
Generate the SQL statements for the task “Change years to current year”. Take the table and date column; write a parameterised SELECT / UPDATE and note to test it in a transaction before committing. Assume CentOS/RHEL or Raspberry Pi OS as appropriate, comment each step, and never hard-code a real credential — read secrets from the environment.
Connect to MySQL
Dumps MySQL databases to a timestamped, optionally gzipped file for backup and restores them with the mysql client.
Commands
#!/bin/sh
date=`date -I`
mysql -h <IP> -D vtx -u root
# Backup all databases
mysqldump --all-databases | gzip > /opt/bak/backup-$date.sql.gz
# Remotely
mysqldump -h <IP> -u root --all-databases > /opt/bak/mysql.$HOSTNAME.`date +%y%m%d`.bak.sql
# Backup a database
mysqldump -h <IP> -u root <INTERNAL_IP> > /opt/bak/mysql.$HOSTNAME.`date +%y%m%d`.bak.sql
# Backup and restore together
mysqldump -uroot -p <DB_PASSWORD> vtx | mysql --host=<IP> -C vtx
# MySQL Restore
mysql -u root -p vtx < /opt/bak/mysql.hostname.date.bak.sql
# Restore in the terminal
mysql -h <IP> -D <SERVER> -u jasperadmin
mysql>source filename.sql
AI prompt
Generate a Bash script for the task “Connect to MySQL”. Parameterise host, user and target database (or --all-databases); write dumps to a dated filename under a backup dir, and provide the matching restore command. Assume CentOS/RHEL or Raspberry Pi OS as appropriate, comment each step, and never hard-code a real credential — read secrets from the environment.
Get user names
Lists MySQL accounts and their host patterns, with the basic create, drop, grant and change-password statements.
Commands
SELECT Host, User FROM mysql.user;
# Create a user
CREATE USER 'root'@'<INTERNAL_IP>' identified by '<DB_PASSWORD>';
# Drop a user
DROP USER 'root'@'<INTERNAL_IP>';
# Grant priveleges
GRANT ALL PRIVILEGES ON *.* TO 'root'@'<INTERNAL_IP>' WITH GRANT OPTION;
# Change a password
SET PASSWORD FOR ''@'localhost' = PASSWORD('<DB_PASSWORD>');
AI prompt
Generate the SQL statements for the task “Get user names”. List accounts from mysql.user, then show CREATE USER, DROP USER, GRANT and ALTER USER … IDENTIFIED BY for a parameterised user and host, noting that SET PASSWORD … PASSWORD() no longer works in MySQL 8. Assume CentOS/RHEL or Raspberry Pi OS as appropriate, comment each step, and never hard-code a real credential — read secrets from the environment.
For a domain
Creates accounts scoped to a domain, a single host and a LAN range, grants them full privileges, and fixes the MySQL 8 SYSTEM_USER privilege error.
Commands
CREATE USER 'myname'@'%.mydomain.com' identified by '<DB_PASSWORD>';
# For localhost
CREATE USER 'root'@'<INTERNAL_IP>' identified by '<DB_PASSWORD>';
# Grant priveleges
GRANT ALL PRIVILEGES ON *.* TO 'root'@'<INTERNAL_IP>' WITH GRANT OPTION;
# For a LAN
CREATE USER 'root'@'192.168%' identified by '<DB_PASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168%' WITH GRANT OPTION;
# SYSTEM_USER issue
GRANT SYSTEM_USER ON *.* TO `root`@`%` WITH GRANT OPTION; GRANT SYSTEM_USER ON *.* TO `root`@`localhost` WITH GRANT OPTION;
AI prompt
Generate the SQL statements for the task “For a domain”. Take a username and a list of host patterns (e.g. %.domain.com, a single IP, 192.168.%); emit CREATE USER … IDENTIFIED BY and a matching GRANT for each, plus the GRANT SYSTEM_USER fix for accounts that must manage other admin users. Assume CentOS/RHEL or Raspberry Pi OS as appropriate, comment each step, and never hard-code a real credential — read secrets from the environment.
MySQL account & privilege management
Creates a MySQL account for a given host pattern and grants it privileges (and shows how to drop it or reset its password).
Commands
create user '<USER>'@'%' identified by '<DB_PASSWORD>';
grant all on *.* to '<USER>'@'%';
flush privileges;
AI prompt
Generate the SQL statements for the task “MySQL account & privilege management”. Take username, host pattern (e.g. %, 192.168.%, host.domain) and database scope; emit CREATE USER … IDENTIFIED BY, the matching GRANT, and FLUSH PRIVILEGES. Assume CentOS/RHEL or Raspberry Pi OS as appropriate, comment each step, and never hard-code a real credential — read secrets from the environment.
MySQL account & privilege management (2)
Grants a user full privileges on specific databases with USE and GRANT ALL.
Commands
use eg;
grant all on eg to 'eg'@'%';
use dejavu;
grant all on eg to 'eg'@'%';
AI prompt
Generate the SQL statements for the task “MySQL account & privilege management (2)”. Take a user, host pattern and list of databases; emit GRANT ALL PRIVILEGES ON <db>.* TO … for each database instead of relying on USE, and finish with SHOW GRANTS to confirm. Assume CentOS/RHEL or Raspberry Pi OS as appropriate, comment each step, and never hard-code a real credential — read secrets from the environment.