SELECT CONCAT("GRANT SELECT ON ",SCHEMA_NAME,".* TO 'test_user'@'localhost';")
FROM information_schema.SCHEMATA
WHERE SCHEMA_NAME NOT LIKE 'mysql';
Monthly Archives: October 2022
test root password
bash to verify root password:
sshpass -p testword ssh [email protected]
or:
pamtester system-auth root authenticate
Password:
pamtester: successfully authenticated
setlocale: No such file or directory
locale -a | grep LT
if nothing found:
locale-gen lt_LT.UTF-8
Generating locales (this might take a while)...
lt_LT.UTF-8... done
Generation complete.
filebeat custom index name
filebeat output to elasticsearch indices
filebeat separate index
filebeat log different index
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/some/path/*.log
fields:
type: "query"
- type: log
enabled: true
paths:
- /var/log/another.path/*.log
fields:
type: "error"
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 3
setup.kibana:
output.elasticsearch:
hosts: ["192.168.1.100:9200"]
index: "newindex-%{[fields.type]:other}-%{+yyyy.MM.dd}"
setup.template.name: "newindex"
setup.template.pattern: "newindex-*"
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository
[Repl] Slave SQL for channel '': Slave failed to initialize relay log info structure from the repository, Error_code: MY-013124
mysql> start slave;
ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository
mysql> reset slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> CHANGE MASTER TO MASTER_HOST='172.17.0.2', MASTER_USER='repl', MASTER_PASSWORD='mypassword', MASTER_LOG_FILE='binlog.000008', MASTER_LOG_POS=157;
Query OK, 0 rows affected, 8 warnings (0.01 sec)
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
[Repl] Slave I/O thread for channel '': connected to master '[email protected]:3306',replication started in log 'binlog.000008' at position 157
E: Unable to locate package percona-xtrabackup-80
To enable Percona tools:
percona-release enable tools release
* Enabling the Percona Tools repository
<*> All done
apt update
apt install percona-xtrabackup-80
cpu usage make graph bash
vmstat -n 1 | gawk '{ print 100-int($(NF-2)); fflush(); }' | ttyplot
apt meilisearch ubuntu
echo "deb [trusted=yes] https://apt.fury.io/meilisearch/ /" | sudo tee /etc/apt/sources.list.d/meilisearch.list
apt update
apt install meilisearch-http
vim /etc/systemd/system/meilisearch.service
[Unit]
Description=MeiliSearch search engine
After=network.target
[Service]
ExecStart=/usr/bin/meilisearch --http-addr 0.0.0.0:7700 --env production --master-key pwd123
Restart=always
[Install]
WantedBy=multi-user.target
pass arguments to alias bash
some grep alias:
g(){ grep \$1 /tmp/some_data.txt | sort -k1 | awk ' {print \$1 ,\"\t\", \$3 }';}
some mkdir alias:
mkcd() { mkdir -p -- "$1" && cd -P -- "$1"; }
put to:
vim ~/.bash_alias
source ~/.bash_alias
awk print with tabs
awk {'print $5"\t"$1'}
tcpdump mysql traffic
tcpdump -i any port 3306
curl resolve
curl resolver:
curl --resolve example.com:80:127.0.0.1 http://example.com/
sponge install linux
apt-get install moreutils
parse error: Invalid numeric literal at line 1,
curl remove -i:
curl -X POST -H 'Content-type:application/json' -d @my_file https://192.168.100.100/api.php | jq .
hosts file per user
if you just need SSH shortcut:
vim ~/.ssh/config file
Host myhost
Hostname 192.168.100.12