PostgreSQL/PgLoader: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 30: Line 30:


|-
|-
|colspan='3'|
|colspan='2'|
----
|-
|colspan='2'|
<syntaxhighlight lang="bash">
BACKUP_DATE_N_TIME="$(date +'%Y%m%d-T%H%M')-Z$(date +'%z'|tr '+-' 'PM')"
echo -n password: ;read -s MYSQL_PWD;export MYSQL_PWD; echo
# password: sadaqah!
 
mariadb      -h127.0.0.1 -P3306 -uchorke -Dacademia
mariadb-dump -h127.0.0.1 -P3306 -uchorke  academia > ./academia-${BACKUP_DATE_N_TIME}.dump
mariadb      -h127.0.0.1 -P3306 -uchorke -Dacademia < ./academia-20241010-T1010-ZP0600.dump
</syntaxhighlight>
 
|-
|colspan='2'|
----
----
|-
|-

Revision as of 07:13, 3 December 2024

cat << EXE | sudo bash
apt-get update;echo
apt list -a --upgradable
apt-get install -y pgloader
EXE

Migration

cat << DDL | mariadb
CREATE DATABASE IF NOT EXISTS academia;
CREATE USER 'chorke'@'%' IDENTIFIED BY 'sadaqah!';
GRANT ALL PRIVILEGES ON academia.* TO 'chorke'@'%';
FLUSH PRIVILEGES;
DDL
cat << DDL | psql
CREATE DATABASE academia;
CREATE USER chorke WITH ENCRYPTED PASSWORD 'sadaqah!';
GRANT ALL PRIVILEGES ON DATABASE academia TO chorke;
ALTER DATABASE academia OWNER TO chorke;
DDL

BACKUP_DATE_N_TIME="$(date +'%Y%m%d-T%H%M')-Z$(date +'%z'|tr '+-' 'PM')"
echo -n password: ;read -s MYSQL_PWD;export MYSQL_PWD; echo
# password: sadaqah!

mariadb      -h127.0.0.1 -P3306 -uchorke -Dacademia
mariadb-dump -h127.0.0.1 -P3306 -uchorke   academia > ./academia-${BACKUP_DATE_N_TIME}.dump
mariadb      -h127.0.0.1 -P3306 -uchorke -Dacademia < ./academia-20241010-T1010-ZP0600.dump

Playground

pgloader -h
pgloader -V

References