Category Archives: Database tips

SQL Server: list all user defined functions in a database

Recently I inherited a database project where many of the functions were not listed nor documented. Thankfully, with the help of the always useful stackoverflow, I was able to find the following snippet for displaying all user functions: select name, definition, type_desc FROM sys.sql_modules m INNER JOIN sys.objects o ON m.object_id=o.object_id where type_desc like ‘%function%’ via sql server – SQL list of all the user defined functions in a database – Stack Overflow. Very cool! 🙂

Turnkey SSH tunnel for MySQL PHP access

Very useful examples at the Linux Journal: http://www.linuxjournal.com/content/creating-secure-tunnels-ssh and I finally found a connection specification that would work: root@lamp ~# mysql -h localhost -P 3308 -u root -psomepassword vlmdatabase ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysq ld.sock’ (2) root@lamp ~# mysql -h localhost -P 3308 -u root -psomepassword vlmdatabase ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysq ld.sock’ (2) root@lamp ~# mysql -h 127.0.0.1 -P 3308 -u root -psomepassword vlmdatabase The last one

Access MySQL server over SSH tunnel using Navicat

Today was my first time to access a MySQL server over a SSH tunnel in Navicat. After a bit of trial and error I was finally able to achieve success 🙂 Here are the main things I learned: #1 On the client machine running Navicat, use the same credentials that you would use if you were at the console of the remote server. In this case localhost and port 3306 #2 On the SSH tab, use the remote server’s IP