When a query is running in MySQL, there are several options for killing it. One is to it, which isn’t recommended. A better way is to use MySQL’s built-in ‘kill’ command. Log in to another instance of MySQL, find the process number of the query, and kill that process. It looks a bit like the following after logging in.

mysql> show processlist;
| Id     | User   | Host      | db        | Command | Time | State        | Info                           |
| 222954 | rouser | localhost | DATABASE  | Query   | 3945 | Sending data | SELECT COUNT(*) FROM BIG_TABLE |
| 223347 | rouser | localhost | NULL      | Query   |    0 | NULL         | show processlist               |
2 rows in set (0.00 sec)
mysql> kill 222954;
Query OK, 0 rows affected (0.00 sec)

Many times in a Unix environment, the file extension of an executable is removed and Vim/Vi may not pick up on the language used. Forcing syntax highlighting in a specific language is easy. For instance, to set the highlighting language to C:

:setf c

For bash:

:setf sh
Posted in Vim


You can connect to MySQL on computer #1 and you can connect from computer #2 to computer #1 via SSH, but you cannot connect directly from computer #2 to computer #1 with MySQL – and you want/need to do so.


Create an SSH tunnel to route the MySQL connection. Here’s how.

On computer #2: Run the following command in a terminal:

ssh username@computer1address -L 3307:localhost:3306 -N

You’ll have to use your password/keys to log in at this point. What some of the options mean:
1) “-L 3307:localhost:3306″ means that we want to bind port 3307 on the local machine (computer #2) to port 3306 on the remote machine (computer #1). After the connection is made, connections on computer #2 going to localhost:3307 will actually be connecting to computer #1′s port 3306.
2) “-N” means to not expect anything to happen after the connection is made. It will just sit there and allow traffic in the background.

Now, you should be able to connect from computer #2 to MySQL on computer #1. On computer #2, now try:

mysql -h -P 3307 -u username -ppassword