This topic was done to skip googling in some cases.
How to get mysql database size:
mysql -uroot -pPASSWORD -D DATABASE_NAME -e "show table status\G"| egrep "(Index|Data)_length" | awk 'BEGIN { rsum = 0 } { rsum += $2 } END { print rsum }'
Source: http://eddnet.org/?p=1765
How to set mysql to read only mode:
Attention! root can do r/w regardless of read_only!
mysql> set GLOBAL read_only = true;
edit config
:/etc/mysql/conf.d# cat slave.cnf
[mysqld]
server-id = 18
innodb_buffer_pool_size = 200MB
read_only = true
[mysqld]
server-id = 18
innodb_buffer_pool_size = 200MB
read_only = true
How to drop user
DROP USER 'USERNAME'@'%';
How to find duplicate rows.
How to delete duplicated Rows
I am not SQL guru, maybe there is another perfect way how to do it, but it`s works:
0 Comments.