drop procedure if exists sp_array_test;

DELIMITER //
create procedure sp_array_test ()

DanBrother 發表在 痞客邦 留言(0) 人氣()

Extracts, orders, and then prints grants for MySQL user accounts (pt-show-grants)
# Extracts, orders, and then prints grants for MySQL user accounts
pt-show-grants --host 10.0.1.120 -u admin --ask-pass --port 3306 > testdb-grants.sql

DanBrother 發表在 痞客邦 留言(0) 人氣()

MySQL Stored Procedure - Nested Loop Example
DELIMITER $$
CREATE PROCEDURE sp_fix_dup_nickname()
BEGIN   
    DECLARE outer_done, inner_done BOOLEAN DEFAULT FALSE;    

DanBrother 發表在 痞客邦 留言(0) 人氣()

Metabase H2 DB Migration to MySQL 5.7
#### On Aurora New MySQL ####################
create database metabase charset utf8mb4;
create user `metabase_app`@`192.168.%` identified by 'xxxxxx';
grant all on metabase.* to `metabase_app`@`192.168.%`;

DanBrother 發表在 痞客邦 留言(0) 人氣()

MySQL 5.7 :  Steps for Upgrading Percona-Toolkit to the Latest Version

pt-online-schema-change --version
>>
pt-online-schema-change 2.2.20

DanBrother 發表在 痞客邦 留言(0) 人氣()

MySQL Slave - Skip Replication for A Particular Table
mysql> stop slave sql_thread;
mysql> change replication filter Replicate_Wild_Ignore_Table=('mydb.my_unused_table1');
mysql> start slave sql_thread;

DanBrother 發表在 痞客邦 留言(0) 人氣()

Export Table Data:
mysql -utest_usr -p"xxx"-h127.0.0.1 -P3306 -e "select * from test_usr.test_table where flag = 1" > test_usr.test_table.txt 2>/dev/null
Import Table Data:   (ignore first row column name)
mysql> LOAD DATA LOCAL INFILE '/home/mysql/test_usr.test_table.txt' INTO TABLE my_new_test_table IGNORE 1 LINES;

DanBrother 發表在 痞客邦 留言(0) 人氣()

check_table_fragmentation.sql
>>
MySQL > source check_table_fragmentation.sql
SELECT table_schema, table_name, CONCAT(ROUND((data_free / 1024 / 1024),2),'MB') as data_free
FROM information_schema.tables

DanBrother 發表在 痞客邦 留言(0) 人氣()

cat log_file_viewer.sh
>>
#################################
# Multiple Log File Viewer (Linux Bash)
# Programmed By DanBrother

DanBrother 發表在 痞客邦 留言(0) 人氣()

There're MySQL global variable settings that will help for improving the speed of SQL apply in slave db.
That would solve the issue of slave lagging.
slave_rows_search_algorithms comes to the rescue.
slave_rows_search_algorithms
default: TABLE_SCAN,INDEX_SCAN

DanBrother 發表在 痞客邦 留言(0) 人氣()

export dbuser='root'
export socket_file=/tmp/mysql_3360.sock

-- dry-run

#Modify Column

DanBrother 發表在 痞客邦 留言(0) 人氣()

MySQL Trigger Example
https://1drv.ms/w/s!AiM4lZDi7mITgZpt7BobprUleWqgHg?e=AuvIpd

DanBrother 發表在 痞客邦 留言(0) 人氣()

Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。