Posts Tagged ‘mysql’

Connecting to MySQL on remote machine

May 31st, 2011 No comments

I just installed Ubuntu 11.04 on a machine that I was using as a shared XBMC database server.  It was the same machine that I was using before.  I backed up the database and restored it on the new machine, but when I went to use XBMC it wouldn’t connect to my shared database.  I tried doing the following from a XBMC machine:

ERROR 2003 (HY000): Can't connect to MySQL server on '###.###.###.###' (111)

After a bit of time on Google I found the solution.  It appears that they changed the security in the latest version of MySQL.  It used to be a setting called skip_networking which had to be set to off, they have since added the bind-address setting in the MySQL my.cnf file.

sudo nano /etc/mysql/my.cnf

You will need to find the bind-address setting and comment it out. Save and exit the file, and then restart MySQL.

sudo /etc/init.d/mysql restart

After that I could connect to the remote database, which was on my LAN. Please note that should take care to make sure that your server isn’t accessible from the outside, e.g. stay behind a firewall.

Categories: Software Tags: , , ,

LAMP with Ubuntu

April 21st, 2011 1 comment

I have a new install of Ubuntu 11.04 beta installed on a machine, and I wanted to use it to do some web development, so I needed to install Apache2 with PHP5 and MySQL. All I needed to do was run a simple command.

sudo apt-get install mysql-server mysql-client apache2 php5 libapache2-mod-php5

You’ll then need to restart apache to get php working.

sudo /etc/init.d/apache2 restart

You may view you phpinfo by editing a file in /var/www/

sudo gedit /var/www/info.php

add the following to the info.php.

<?php phpinfo(); ?>

Now visit http://localhost/info.php to view your php info. You may also want to add additional things to php5. You may search the repository using

sudo aptitude search php5

Then once you found what other things you’d like to have installed you may do so by entering something like

sudo aptitude install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json

Usually I need to have mod_rewrite enabled for my applications to work.

sudo a2enmod rewrite

Finally you may want to install phpmyadmin for working with your MySQL databases

sudo apt-get install phpmyadmin
Categories: Operating Systems Tags: , , , ,