Skip to content

Instantly share code, notes, and snippets.

View mysql8-charset.json
{
"character_sets": [
{
"name": "armscii8",
"description": "ARMSCII-8 Armenian",
"default_collation": "armscii8_general_ci",
"collations": [
"armscii8_general_ci",
"armscii8_bin"
]
@alastori
alastori / mysql-charsets.js
Created Jun 10, 2022
MySQL Shell script to create a nested JSON with character sets and collations
View mysql-charsets.js
// MySQL Shell script to create a nested JSON with character sets and collations
session.setCurrentSchema('information_schema');
var query = 'SELECT cs.CHARACTER_SET_NAME, cs.DESCRIPTION, cs.DEFAULT_COLLATE_NAME, co.COLLATION_NAME, co.IS_DEFAULT FROM CHARACTER_SETS as cs, COLLATIONS as co WHERE cs.CHARACTER_SET_NAME = co.CHARACTER_SET_NAME ORDER BY cs.CHARACTER_SET_NAME, co.IS_DEFAULT DESC, co.COLLATION_NAME';
var res = session.sql(query).execute();
var myJson = {['character_sets']:[]};
var row = res.fetchOne();
while(row) {
var character_set = {'name': {}, 'description': {}, 'default_collation': {}, 'collations': []};
character_set.name = row[0];
@alastori
alastori / python3-venv.md
Last active May 26, 2022
Python 3 virtual environment
View python3-venv.md

Create a new Python Virtual Environment

Pre-requistes

Define the directory

$ export VENVDIR=~/test-python

Check if Python 3 is installed

@alastori
alastori / Tutorial - Connecting to a MySQL Database Service DB System with a public IP address using a Network Load Balancer.md
Last active Dec 10, 2021
How to configure an Oracle Cloud Infrastructure Network Load Balancer with a MySQL Database Service DB System backend. You can use this to create a Public Endpoint to a single read-write MySQL DB System or multiple read-only MySQL DB Systems.
View Tutorial - Connecting to a MySQL Database Service DB System with a public IP address using a Network Load Balancer.md

Tutorial - Connecting to a MySQL Database Service DB System with a public IP address using a Network Load Balancer

This tutorial will teach you how to configure an Oracle Cloud Infrastructure Network Load Balancer with a MySQL Database Service DB System backend. You can use this to create a public endpoint to a single MySQL DB System backend.

> Note: It is a high security risk to expose your database to be accessible by hosts from the internet. Consider using the Bastion Service or a VPN. In cases where access via public IP address is the only alternative, ensure you restrict the authorized external IP addresses to the minimum and use in-transit encryption. Check the [OCI Networking best practices](https://docs.cloud.o

@alastori
alastori / ODBC TLS and MDS.md
Last active Oct 6, 2021
MySQL Connector/ODBC SSL connections with MySQL Database Service
View ODBC TLS and MDS.md

ODBC TLS and MDS

Testing encrypted connections using MySQL Connector/ODBC with MySQL Database Service.

Install MySQL Connector/ODBC 8.0.26 on Oracle Linux 7.8

$ sudo cat /etc/os-release | grep NAME
NAME="Oracle Linux Server"
PRETTY_NAME="Oracle Linux Server 7.8"
CPE_NAME="cpe:/o:oracle:linux:7:8:server"
View OCI Usage Analysis with MySQL.md

OCI Usage Analysis with MySQL

Manual download of OCI usage data

Using the OCI web console, go to the Menu > Account Management > Usage Report.

Example:

reports/usage-csv/0001000000072041.csv.gz
reports/usage-csv/0001000000071666.csv.gz
reports/usage-csv/0001000000071275.csv.gz
View docker-run-mysql.txt
# Get latest MySQL image available at Docker Hub
# https://hub.docker.com/_/mysql/ (not Oracle MySQL)
docker pull mysql:latest
docker images
# Create and run a container with MySQL named as 'mysql8'
docker run --name mysql8 -e MYSQL_ROOT_PASSWORD=Root123! -d mysql:latest
# Check if the constainer 'mysql8' is running
docker ps
@alastori
alastori / provision-mysql57-commercial-yum-repo-el7.sh
Created Oct 30, 2017
Bash script to create a local YUM repository for MySQL Commercial RPMs in Enterprise Linux 7.x.
View provision-mysql57-commercial-yum-repo-el7.sh
#!/bin/bash
#Bash script to create a local YUM repository for MySQL Commercial RPMs in Enterprise Linux 7.x.
#You can find the commercial binaries in http://support.oracle.com (preferable) or http://edelivery.oracle.com.
#Download the ZIP files into the $DOWNLOAD_DIR and run this script as root.
#The files to be downloaded are:
# MySQL Database 5.7.* RPM for Oracle Linux / RHEL 7 x86 (64bit)
# MySQL Enterprise Backup 4.1.* RPM for Oracle Linux / RHEL 7 x86 (64bit)
# MySQL Shell 1.0.* RPM for Oracle Linux / RHEL 7 x86 (64bit)
# MySQL Router 2.1.* RPM for Oracle Linux / RHEL 7 x86 (64bit)
@alastori
alastori / provision-httpd-el7-yum.sh
Created Oct 26, 2017
Bash script to install Apache httpd Server in Enterprise Linux 7.x
View provision-httpd-el7-yum.sh
#!/bin/bash
#Bash script to install Apache httpd Server in Enterprise Linux 7.x
#Run this script as root
set -e # stop script execution on any error
#Install Apache httpd
yum -y install httpd
#check with: systemctl list-unit-files | grep httpd
@alastori
alastori / provision-puppetserver-el7-yum.sh
Last active Nov 8, 2017
Bash script to install Puppet via puppetlabs.com YUM public repository in Enterprise Linux 7.x
View provision-puppetserver-el7-yum.sh
#!/bin/bash
#Bash script to install Puppet Server via puppetlabs.com YUM public repository in Enterprise Linux 7.x
#Run this script as root
set -e # stop script execution on any error
echo "Installing Puppet Server..."
#Install Puppet YUM repository