Wednesday, February 4, 2026

.::: create Tools Migration from MariaDB to PostgreSQL using bash shell script (no csv):::.

  
correlation https://teguhth.blogspot.com/2025/12/create-tools-migration-from-postgresql.html

1. sample data edb & mariadb

MySQL MariaDB
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html

PostgreSQL
https://teguhth.blogspot.com/2019/09/study-kasus-praktis-belajar-query.html

2. data server A & B 

server A Mariadb
ip : 10.10.10.9
db : teguhth
port 3306
user : admin
password : admin

server B Postgres
ip : 10.10.10.90
db : mariaedb
port 5432
user : admin
password : admin
 

Friday, January 30, 2026

.::: Script backup Daily MariaDB Windows :::.

  

1. check
SHOW VARIABLES LIKE 'datadir';
SHOW VARIABLES LIKE 'basedir';

C:\Windows\system32>mariadb -uroot -proot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.11.11-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SHOW VARIABLES LIKE 'datadir';
+---------------+--------------------------------------+
| Variable_name | Value                                |
+---------------+--------------------------------------+
| datadir       | C:\Program Files\MariaDB 10.11\data\ |
+---------------+--------------------------------------+
1 row in set (0.001 sec)

MariaDB [(none)]> SHOW VARIABLES LIKE 'basedir';
+---------------+---------------------------------+
| Variable_name | Value                           |
+---------------+---------------------------------+
| basedir       | C:\Program Files\MariaDB 10.11\ |
+---------------+---------------------------------+
1 row in set (0.001 sec)

MariaDB [(none)]>

Wednesday, January 28, 2026

.::: Shell Script to Detect and Compare AI-Generated vs Original Images and Videos :::.

  

A. Install

1. Install for image

sudo dnf install ImageMagick -y
sudo dnf install perl-Image-ExifTool -y

[root@teguhth-all sampleimage]# identify -version
Version: ImageMagick 6.9.13-25 Q16 x86_64 18639 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib
[root@teguhth-all sampleimage]#

[root@teguhth-all sampleimage]# convert -version
Version: ImageMagick 6.9.13-25 Q16 x86_64 18639 https://legacy.imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib gvc jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib

[root@teguhth-all sampleimage]# exiftool -ver
13.10
[root@teguhth-all sampleimage]#

Monday, January 12, 2026

.::: Script to kill Locking in Database Oracle using oracle & root User :::.

 

1. run from https://teguhth.blogspot.com/2024/11/how-to-sample-simulation-blocking.html

export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
export ORACLE_SID=tgh
export PATH=$ORACLE_HOME/bin:$PATH
 
or 
 
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 
export ORACLE_SID=tgh 
export PATH=$ORACLE_HOME/bin:$PATH 

2. original script locking
SELECT
    s1.sid AS waiting_session,
    s1.serial# AS waiting_serial,
    s1.username AS waiting_user,
    s1.status AS waiting_status,
    s2.sid AS blocking_session,
    s2.serial# AS blocking_serial,
    s2.username AS blocking_user,
    s2.status AS blocking_status,
 s1.event,
    'ALTER SYSTEM KILL SESSION ''' || s1.sid || ',' || s1.serial# || ''' IMMEDIATE;' AS query_kill
FROM
    v$session s1
JOIN
    v$session s2
ON
    s1.blocking_session = s2.sid;

Friday, January 9, 2026

.::: Find ENCRYPTION_KEY_ID & CURRENT_KEY_ID MariaDB from OS & Database MariaDB :::.

 

correlation https://teguhth.blogspot.com/2023/06/enable-encryption-table-database-for.html
https://teguhth.blogspot.com/2023/05/how-to-remove-encryptionkeyid-from-file.html


A. from OS

1. query 1 
grep -o 'ENCRYPTION_KEY_ID`=[0-9]*' teguhth_enc.sql | sort | uniq

2. query 2

grep -o 'ENCRYPTION_KEY_ID`=[0-9]*' teguhth_enc.sql | cut -d= -f2 | sort | uniq

3. query 3

grep -i  ENCRYPTION_KEY_ID teguhth_enc.sql
 
 

Tuesday, January 6, 2026

.::: Sample Create VIEW, Routine / Store Procedure, Trigger with DEFINER=`simple_admin`@`%` in MariaDB :::.

 


correlation https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html#more

1. create user 

SELECT Host, User FROM mysql.user WHERE User='simple_admin';

create user 'simple_admin'@'%' identified by 'simple_admin';

GRANT CREATE ROUTINE, ALTER ROUTINE, TRIGGER, CREATE VIEW
ON teguhth.* TO `simple_admin`@`%`;

GRANT EXECUTE ON PROCEDURE teguhth.sp_insert_pembelian
TO 'simple_admin'@'%';

GRANT ALL PRIVILEGES ON *.* TO 'simple_admin'@'%' WITH GRANT OPTION;

flush PRIVILEGES;

Kalau DEFINER tidak ada ? ERROR 1449

 

Friday, January 2, 2026

.::: Sample Access Database MariaDB via Frontend & Backend using php :::.

 

1. instal httpd

2. config 


[root@teguhth-all html]# pwd
/var/www/html
[root@teguhth-all html]# cat config.php
<?php
$host = "10.10.10.90";
$user = "admin";
$pass = "admin";
$db   = "teguhth";
$port = 3306;

$conn = new mysqli($host, $user, $pass, $db, $port);

if ($conn->connect_error) {
    die("Koneksi gagal: " . $conn->connect_error);
}
?>

[root@teguhth-all html]#
 

Wednesday, December 24, 2025

.::: create Tools Migration from SQL Server MSSQL to MariaDB using bash shell script :::.

 

correlation with correlation with https://teguhth.blogspot.com/2024/01/install-configure-odbcinstini-odbc-for.html

1. sample data mssql & mariadb

MySQL MariaDB
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html

MSSQL
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query.html

2. data server A & B 
server A sql server
ip : 10.10.10.7
db : teguhth
schema : dbo
port 1433
user : admin 
password : admin11!!

server B Mariadb
ip : 10.10.10.90
db : teguhthsql
port 3306
user : admin
password : admin

mysql -h 10.10.10.90 -uadmin -p --skip-ssl

buat script shell untuk migrasi dari server A mssql to server B 

Tuesday, December 23, 2025

.::: create Tools Migration from MariaDB to MongoDB using bash shell script :::.

 
 
 

correlation with https://teguhth.blogspot.com/2025/12/create-tools-migration-from-mongodb-to.html
 



1. data migration server A Maria to server B mongo
server A Mariadb
ip : 10.10.10.90
db : teguhth
port 3306
user : admin
password : admin

server B mongodb
ip : 10.10.10.9
db : mariadbsample
port 27017
user : admin
password : admin

buat script shell untuk migrasi dari server A maria to server B mongo 

 

Monday, December 22, 2025

.::: create Tools Migration from MongoDB to MariaDB using bash shell script :::.

 
1. sample data edb & mariadb

MySQL MariaDB
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html

MongoDB
https://teguhth.blogspot.com/2020/12/study-kasus-praktis-belajar-query.html

2. data server A & B 
server A mongodb
ip : 10.10.10.9
db : teguhth
port 27017
user : admin
password : admin

server B Mariadb
ip : 10.10.10.90
db : teguhthedb
port 3306
user : admin
password : admin

buat script shell untuk migrasi dari server A postgres to server B

.::: create Tools Migration from PostgreSQL to MariaDB using bash shell script :::.

  

1. sample data edb & mariadb

MySQL MariaDB
https://teguhth.blogspot.com/2019/04/study-kasus-praktis-belajar-query-mysql.html

PostgreSQL
https://teguhth.blogspot.com/2019/09/study-kasus-praktis-belajar-query.html

2. data server A & B 
server A Postgres
ip : 10.10.10.9
db : teguhth
port 5432
user : admin
password : admin

server B Mariadb
ip : 10.10.10.90
db : teguhthedb
port 3306
user : admin
password : admin

Friday, December 19, 2025

.::: DBLink MariaDB Manipulation with Shell Scipt to insert table from Server A to Server B :::.

 

A. sample source server A server B sample 

1. record source & destination

=== source ===
ip       : 10.10.10.90
porr     : 3306
database : dbatools
table    : dbsizeos

=== destination ==
ip       : 10.10.10.9
porr     : 3306
database : dbatools
table    : list_dbsizeos

 

.::: Script insert database size & record to table base on size folder in OS Linux example MariaDB :::.

 
correlation https://teguhth.blogspot.com/2025/12/script-check-size-database-base-on-size.html

A. Using basic table info

1. create table


CREATE TABLE IF NOT EXISTS dbsizeos (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    capture_time DATETIME DEFAULT CURRENT_TIMESTAMP,
    db_name VARCHAR(100) NOT NULL,
    size_bytes BIGINT NOT NULL,
    size_mb DECIMAL(12,2) NOT NULL  
);

2.script 

Popular Posts