Optimize all your MySQL tables

Here is a small code snipped I’m using to optimize (or repair or defragment) mysql tables.

When for eg. mysqltuner shows something like “Total fragmented tables: 20” and you are awake at a very unpopular time (table optimization will lock your tables so it is possible your site is unreachable for a few moments) you can simply paste the following to your shell:

LOGIN="-u<user> -p<secret>"
mysql $LOGIN <<EOF
$(for db in `mysql $LOGIN -e 'show databases'|sed -e 's/\|//g'|egrep -v '^Database|information_schema|performance_schema'` ; do
echo "USE $db;" ; mysql $LOGIN -D$db -e 'show tables'|sed -e 's/\|//g'|egrep -v '^Tables_in_'|awk '{print "OPTIMIZE TABLE "$1";"}'
done)
EOF

You have to change your mysql login details or leave it empty if you are using the ~/.my.cnf config file.

Advertisements
Posted in Database, Debian, Howto, Linux, MySQL, Shell, Snippet | Tagged , , , , | Leave a comment

Boosting CRDA regulatory database

Today I will show how to change the CRDA regulatory database to use all available channels and the full power of your wireless adapter.

Continue reading

Posted in Backtrack, Debian, Drivers, Howto, Linux, Wireless | Tagged , , , , , | Leave a comment

Fixing the regulatory domain (CRDA) of Realtek’s RTL8192 linux wifi drivers

I found that the current realtek linux driver series rtl8192** (in my case the Alfa AWUS036NHR high power USB wifi card using the RTL8188RU chipset) ignores the regulatory set by the CRDA service. Cause of that the card will only have channels 1 to 11 and runs at maximum 20 dBm. This is the world standard of CRDA.

Continue reading

Posted in Backtrack, Debian, Drivers, Howto, Linux, Wireless | Tagged , , , , , , , , , , , | Leave a comment