Monday, September 7, 2009

eSpace makes it into Rails Magazine

aking their biggest steps since they started in 2000, eSpace is taking steady steps into the community of Rails, proving its leadership in Ruby on rails solutions in Egypt. Check out the full article on Rails Magazine



Here is a couple of pictures from the event, the first one shows eSpace's CTO, Mohamad Ali with Matz. The second picture of Ali giving a presentation about Neverblock, a ruby solution for concurrent operations, developed by eSpace. eSpace is using it currently in many production servers, such as Alsaha


Sunday, July 26, 2009

Recovering MySQL root password

Have you ever dealt with different Mysql Installations on different machines?
Have you ever mixed up root passwords of different installations?

I recently had that happened to me, I decided to look further into it and find a good way to do a password reset for my root account.

Here is what we will do:

  1. Stop the mysql daemon.

  2. Start mysql with "--skip-grant-table" option.

  3. login with your root account with no password.

  4. update the mysql.users table with your new password.

  5. restart the mysql default daemon.


Step1: stop the running mysql daemon
/etc/init.d/mysql stop

Output:
* Stopping MySQL database server mysqld  [ OK ]

Note: Make sure it is stopped with the following command
ps aux | grep mysql

You should see only one entry for the grep command you just typed.

Step2: we start mysql with "--skip-grant-table" option.
mysqld_safe --skip-grant-table

You should find output similar when you hit
ps aux | grep mysql7090 pts/1    S      0:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-table7129 pts/1    Sl     0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock --skip-grant-table7131 pts/1    S      0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld7246 pts/2    S+     0:00 grep --color=auto mysql

You should login successfully without any password.
mysql -uroot

Step4: change your root password
use mysql;
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
flush privileges;
quit

/etc/init.d/mysql stop/etc/init.d/mysql start

You should be able to login normally with your new password.
Monday, April 20, 2009

Changing your home directory to a new Drive on Ubuntu

I recently was trying to install Windows with my Ubuntu on my machine. I ended up moving my /home partition to another extended one :).

Windows Vista can't be installed on an extended partition (or at least that is what it told me), so i had to make a new primary partition for it. Since I'm using 3 primary partitions for my linux (boot, root and home) plus the extended partition area. The total primary partition (and maximum you can have) is 4 primary partitions. I had to relocate one of my Linux partitions to an extended one. Either i move my boot partition, or the home partition. home was my choice so i did the following.

First you have to make a new extended partition for your home. I choose to try the reiserfs as i read it has some performance advantage over ext3. let's call it /dev/sda5.

Next, you should mount it and copy all your /home data to your new partition.

sudo mkdir /media/home_new
sudo mount -t ext3 /dev/sda6 /media/home_new

replace "sda6" with your correct drive file

Next copy your files:
Since your "/home" directory will have soft links, hard links and nested directories, normal copy "cp" will not do the job. We can use a command similar to the one in the Debian archiving directory

find . -depth -print0 | cpio --null --sparse -pvd /media/home_new

After copying the data you have to edit "/etc/fstab" to make sure your "/home" is pointing to your new partition. You may find some "UUID"s instead of "/dev/..." just replace your UUID with your new drive path "/dev/sda6" or whatever it is.
/dev/sda6  /home reiserfs relatime  0 2

I just replaced the drive file and the file system as i changed both of them. It is best to keep the rest on their default settings.

Now Restart your machine and everything should work fine.You can even create a new primary partition for your windows installation now.