Friday 17 September 2010

Starting off with MySQL

Ive just had to install a MySQL server on one of our Debian machine and thought it would be great to add a short tutorial for people who would like to start installing and configuring their MySQL databases under linux. I'll assume that you are using a Debian based linux, but I cant imagine the commands being too different in any other linux.

So what is MySQL? It is a Relational Database Management System (RDMS), which runs on a server/client architecture and provides multi-user access to the data simultaneously. Did I also mention that its insanely fast, and a great place to learn about RDMS without having to pay $$$ for an enterprise database. (Quite recently they were acquired by oracle, but the development of the community edition is still ongoing).

MySQL is "the worlds most popular open source database" in their own words, and I have a feeling they are right about that, as it appears everyone who develops web application usually follows the PHP/MySQL or RoR/MySQL path to start off with.

Ok, heard enough? Lets get on with it already.


Installation:

Fire up a terminal window and give yourself superuser access, using the 'su' command. Ubuntu users, remember to 'sudo' your commands.

apt-get install mysql-server

That pulls up the latest version of the mysql server from the debian repository and installs it. Read the instructions while installation is ongoing, and if you are in a server environment you will need to allow the mysql database to start at boot up.


Usage:

To test your installation type:
mysql

If that lets you in to the database console, voila mysql has been successfully installed, although you dont really need to do this, as the installation should quit cleanly without errors. If it complains, ensure you have hall the needed packages and google your way out of the mess.

now 'quit' out of the mysql console, and set your root password as follows:

mysqladmin -u root password NEWPASSWORD

If you want more information on using the database, the MySQL site has some great webinars. Go check them out: http://www.mysql.com/news-and-events/on-demand-webinars/

Thats all I have for you for now, I dont really have time or space to describe mysql usage here, so we can leave that as a topic for a later date.

Monday 9 August 2010

Locked out of Ubuntu?

You may be faced with a situation similar to one in which I found myself, in which case here's the story of my escapade. I recently dug up an old laptop which had Ubuntu installed on it, and I had no idea what I set up as the password for my user account on the system. Before formatting the entire hard drive, I wanted to check if I had any valuable data on the hard drive, so my options were:

- Slave the IDE hard drive on a system that can read ext3
- Use a linux boot CD to see if I could mount the hard drive
- Attempt to boot into bash as root

I chose to go for the option as it was the easiest to do, without having to get up from my seat :)

---------------------------------------------------------------------------------------------------------------------------------------- Note:
By default, Ubuntu installs a recovery mode in the GRUB menu, if thats there, then you can enter the recovery console (which puts you as the root user) and use the passwd command to change any users password.

----------------------------------------------------------------------------------------------------------------------------------------

Unfortunately I didnt have that option as I took it out as a security measure. Little know to some people is that the grub boot menu can be edited in most cases by pressing 'e' whilst the menu is showing. (You may need to press the escape key to enable this feature.

So highlight the kernal you want to edit, and press 'e', highlight the line that begins with the word kernal and press 'e' again.


Now you need to edit the end of this line and delete the 'ro quiet splash' part and replace it with 'rw init=/bin/bash'. This will boot the kernal straight into bash as root.


Save this by pressing escape and it should take you back to the previous screen. Press 'b' to boot into the kernal, for which you have just edited the settings for.

From here you should be logged into a shell with root access. To change any users password, simply use the passwd command.

passwd [username]

And you have regained control of your account again. Don't forget to change the boot settings back to what they were.

Happy hacking :)

Monday 21 June 2010

Introductory post

“I’m 01100110 01100101 01100101 01101100 01101001 01101110 01100111 00100000 01101100 01110101 01100011 01101011 01111001 00001010.”

Welcome to my blog, this is currently a place for me to jot down any pressing ideas and for me to brainstorm anything and everything I can think up of.

To start off, I suppose a little bit of information about who I am is in order. Well here we are, meet me, my name is Husman, im a computer science graduate, I like tinkering with software and hardware. My current list of interests and projects involve playing with Linux and freeBSD, Ajax, OOP languages like Java, C/C++ and python, 3D graphics, web based programming, databases and astro physics. (Ok, the part about the astro physics isn't entirely true).

I'll be putting up some more information on any projects I take part in, and document what I did, in the hopes that you'll find it interesting or of some use. With that said, I think its enough for the first post.

This is me, signing off.