mysql

How to get size of whole mysql-db?

SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) „size“ FROM information_schema.tables GROUP BY „size“;

mysql-fuzzy-logic

If you want to search words that are not spelled correctly you can use mysql’s buildin SOUNDEX function:

SELECT * FROM po_images
WHERE SOUNDEX(`keyword`) LIKE CONCAT(
  '%',SUBSTRING(SOUNDEX('wronk spellet wort'),2),'%'
);

 

 

send internet traffic over a proxy with tsocks

Sometimes it happens that you can’t use your services cause they deal with blocked ports. For exampel you use mysql on the commandline and it is by some reason denied. A proxy can help you. Tsocks helps you to use a proxy. Tsocks is a library for intercepting outgoing network connections and redirecting them through a SOCKS server.

install tsocks with

sudo apt-get install tsocks

Configure the file /etc/tsocks.conf

# the proxys address
server = 10.100.13.50
# the server type
server_type = 5
# the proxys port
server_port = 3306

and finally call your command like this:

tsocks mysql -h myHost -u myUser -pPassword