Posted by: stephenmit | 30 May 2009

Accessing MySQL via command line

The need to run MySQL queries on the Linux command line comes up from time to time. I will briefly outline how to do so here.

Login to the server via SSH and type:

mysql -u username -p 

Adding the option of -A at the end of this will also speed things up when selecting a database. I found with a large quantity of tables I was not able to wait long enough for them to load, and as a result I was not able to use the mysql command line interface.

Once this is done, the password prompt comes up, and on successful entering of the password, you can type away into mysql as you please.

Posted by: stephenmit | 30 May 2009

Setting up a local installation of Git

With every new machine comes the need to re-install the bear essentials. This post will briefly outline what is required to get Git setup on a local machine and how to communicate with GitHub. It is assumed that an account is already created on GitHub and that there is an existing repository that you wish to use.

Getting the installation

Git is available for windows users from Google Code, the file directory is located here. On this page there are a variety of versions available, I just went for the most straight forward option, which is the first. This installs the full version of Git required for day to day use.

Once the file has been downloaded, a few steps have to be taken to get through the installer. Clicking through is essentially alright and most of the options are acceptable.

Once Git is installed, it is best to open it up and generate an SSH key to give to GitHub.  Open Git and generate the SSH key by typing the following:

ssh-keygen -C “your@email.address” -t rsa

It will give you an install directory option, and pressing enter will accept the default one. A password is then required, and this will be used every time Git communicates with GitHub. Having the key generated, just navigate to the file and open it. Copy the entire contents and head to GitHub. 

Cloning the first repository

If you are not logged in already, do so and go to the account page. Half way down on the left you can add a new SSH key, just paste what you have already copied in here.

Once the key is generated and given to GitHub,  go back into Git and navigate to where you would like your GitHub repositories to be stored. Clone your existing repository if you have one, by typing

git clone

This will first ask you if you wish to continue, as it will not recognise the “new” local machine. Typing yes is required to continue. Once this is done, the password given during the generation of the SSH key is required, and Git should then get to work cloning the repository.

That should be it!