Monday, June 03, 2013

LAM(Pi)

So over the weekend I decided to use my Raspberry pi to do a little bit of website development.

This is an interesting task. I've been actually developing the site on a windows box, but as I plan to host on inux evenutally I thought that I should test on linux, usually this would mean spinning up a VM, but I thought since I have the Raspberry Pi, (and I want to think of a web enabled hardware project also, now would be a good time to get to installing some standard LAMP type tools

first install apache

apt-get apache2
then php
apt-get php5
then mysql
apt-get mysql-server
then the PHP and my sql tools
apt-get php5-mysql

then I want to have a live AND a test site, to you need to configure apache.
I'm putting my test site on an alternate port (I suppose I could use named hosts)
do as well as making a new site in site-available and linking it to sites enabled you have to edit ports.conf too

now, a load of people suggest installing phpmyadmin.

This is a pretty cool tool, I've used it plenty of times before when developing siets. but, I don't reall want that on this box, the reason is, that when I used it before there were pretty much no graphical tools for mysql administration, it was CLI or developing some kind of app.

since Oracle bought MySQL the've written some pretty nice GUI connect and administer tools. (which is weird because the oracle ones are pretty bloated and shite)

then I want to use the GUI tools on my windows machine to admin the mysel server

So I keep getting a connecttion failed error
can't connect to server 10060

Turn out that this means taht the server isn't listening,
but it should be, I am actually running code on it, my site is working perfect databases are being accessed.

Oh wait, turns out that the default config is to listen for connecttions to local host only.

So edit     /etc/mysql/my.cnf and change the bind address from bind 127.0.0.1 to bind (your ip address) (make sure you set a static address, you don;t want this changing!!)

But wait, now the tools are saying they can see the server, but throw up the message

Host 192.168.1.11 (my computer) is not allowed to connect to this MySQL server.

You have to grant the user access from specific IP locations. (a pretty neat sucurity feature I guess)

To do this you'll need to log on to your MySQL installation as root.
(so from the command line (Via SSH if you like))
mysql -u root -p

Then you'll want to use the MySQL equivalent of the system databases,

use mysql

 And finally, grant access to the machine to be able to connect to the server:

 grant all on *.* to root@'[clinet IP]' identified by 'password'

(or grant select insert delete on *.* to web_site_user@'web_site_server_IP' identified by 'web_site_user password')




No comments: