Tuesday, April 2, 2013

Installing MySQL on raspberry pi

Hello Lemmings!
Here's a small tutorial on how to install mysql on Raspberry PI

First upgrade and update your system by running the following command (it can take a while and download large ammounts of data)

sudo apt-get install update upgrade

then install mysql

sudo apt-get install mysql-server

during the installation you will be asked for root password (from now on reffered as [ROOTPWD]).


After this simple installation your MySQL instance will be running on your Raspberry PI. THe instance is already running and will start automatically on your raspberry after restart.

In case you want to restart it on the fly type:
/etc/init.d/mysql stop

and then to start it again

/etc/init.d/mysql start

Here are some tweeks:
1.  Prepare your mysql instance for production
Run following command to remove all testing databases and users which are installed by default:

mysql_secure_installation

in the upcoming dialogs you can set your root password, whether you can connect from outside to the mysql and so on. The same configuration can be also done in following configuration file

/etc/mysql/my.cnf

2. Create new schema
 
run mysql and login as root:
mysql -u root -p

enter [ROOTPWD] when required

when logged in successfully your currsor will looke like this
mysql>_

now create the new schema by following command
create database [DB_NAME];

 3. grant privileges to connect to your database from different machine

you will need an IP address of this machine to grant the privileges.
In windows you can try to rund command line (Widows+R, then type cmd and press enter)
In command line window enter following command:
ipconfig -all

search for entry like
IPv4 address . . . . . . . . . . : 192.168.1.[x](Preffered)

from now on let's reffer to this IP address as [REMOTE_IP_ADDRESS]

then go back to rasberry pi command line, run mysql and login as root as in step [2]
then exectute following command:

grant all on [DB_NAME].* to root@'[REMOTE_IP_ADDRESS]' identified by '[ROOTPWD]';

now you can try to launch your MySQL workbench and connect to raspberry pi from your win machine




Friday, February 15, 2013

Raspberry PI - hostname settings

Default hostname in raspbian
The default hostname set in raspbian is "raspberrypi". You can find and modify it in following file:

\etc\hostname


Out of the box, Raspberry PI is not recognized from windows when pinging via it's default hostname and PI is not able to ping windows machines.

Access Raspberry PI from windows
In this case, it is due to the fact that samba is not installed by default in raspbian.
To install samba type:

sudo apt-get install samba

you can try to ping PI from windows to check if it worked:

ping raspberrypi


Access windows machines from Raspberry PI
In this case installing winbind will do the trick:
To install winbind type:

sudo apt-get install winbind

then modify file /etc/samba/smb.conf


change:
workgroup = HOMENETWORK

modify file /etc/nsswitch.conf

change the line
"hosts: files dns"
to
"hosts: files dns wins"

after that you can try to ping your windows machine from raspberry terminal to check if everything worked fine:

ping [winmachine_host_name]

after that, you can access your machines by host name

My Raspberry PI arrived

Hello everyone!

Today my raspberry PI  Model B arrived!
I'm excited to see what this small machine can do!

What do i plan to do with it?

Perform an initial setup
Create as simple SVN server connected to a FTP as a repository.
Publish a simple page with some lightweight server.
Try RASPBMC as a media player

So checkout my blog in upcoming weeks to see what's the progress.