The Passionate Craftsman

Ruby, PHP, MySql, Software engineering and more.

Saturday, 15 December 2012

Raspberry Pi

Today I received my Raspberry Pi! I bought this book: Raspberry Pi User Guide. It is short, simple and a practical book. Most of the book is written for Linux newbies but the second part has an expalantion on how ot use the GPIO. I realised I can power the board with an iPhone power supply but I need a micro USB to deliver the power... I am using my Kindle USB cable! The box wrapping the Pi could be used as a 'PC case', but I will have to drill it to connect the cables. I downloaded this program to flash the 2GB SD card: http://alltheware.wordpress.com/2012/12/11/easiest-way-sd-card-setup/. The Linux distro to be flashed in the card is available on the Pi web site, I download the Debian image but I think I will try the Arch Linux version too. At the initial boot I set up the keyboard, local time and other settings, the configuration menu is very simple. The Windows manager is lightweight and powerful, I love it. I am having an overall good impression.

Labels: ,

Sunday, 13 November 2011

Unix: change password one line

Labels: , ,

How to change the user password without re-typing the passowrd

You can use the following script to change the user password as root without having to re-type the password:



I found this script helpful when called via ssh.

Labels: , , ,

Friday, 12 August 2011

Install MySql generic binary on Linux

I want to have the latest GA version of MySql, the 5.5.x instead of the old 5.1 release. 5.5.x has many performance improvements, from x2 to x8, according to an article of Guiseppe Maxia, a MySql expert. Go to the download page and get the tar gizipped binary version of Mysql. I downloaded this one:

# apt-get install libaio1
# wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15-linux2.6-x86_64.tar.gz/from/http://mysql.mirrors.ovh.net/ftp.mysql.com/
# mv index.html mysql.tar.gz
# tar xzfv mysql.tar.gz
# mv mysql-5.5.15-linux2.6-x86_64/ mysql-5.5.15
# mv mysql-5.5.15/ /usr/local/
# cd /usr/local/
# ln -s mysql-5.5.15/ mysql
# cd mysql
# chown -R mysql .
# chgrp -R mysql .
# scripts/mysql_install_db --user=mysql
# cp support-files/mysql.server /etc/init.d/mysql.server
# cp support-files/my-medium.cnf /etc/my.cnf
# chmod +x /etc/init.d/mysql.server
# update-rc.d mysql.server defaults
# /etc/init.d/mysql.server start
Starting MySQL.. *
# /etc/init.d/mysql.server restart
# bin/mysql -uroot

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=PASSWORD("your_passwd") where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

Done! Simple isn't it?

Reference: http://dev.mysql.com/doc/refman/5.5/en/binary-installation.html

Labels: ,