Monday 21 May 2012

Still installing MySQL and PHP

Today I was trying to finish installing the latest versions of PHP and MySQL on the web server, unfortunately it was not without its problems.

Yesterday I had a problem where I lost my ssh connection the web server part way through the PHP build process (just running make test, so not important). But it could be a problem if you lost connection part-way through doing something, particularly if it was an interactive process.

I found out that to avoid this you can use a program called screen, and there is a nice tutorial on it here: Linux Screen Tutorial and How To. Screen seemed to work fine for me, though my SSH connection didn't drop, so I didn't get to try reconnecting to an open screen session.

The first problem I had with my install process was that I couldn't create / move files to the directory where mysql is installed. In my install process on my local environment I just rename the existing mysql dir to mysql-old mv $PATHMYSQL $PATHMYSQL-old, and then install the new version to mysql. But since I couldn't do this on the webserver, I instead had to create a directory in a different place (where I did have write permissions) mkdir ~/mysql-old, and then move the contents of mysql to this dir mv $PATHMYSQL/* ~/mysql-old.

The other problem was that when I ran mysql_install_db --basedir=$PATHMYSQL --datadir=$PATHMYSQL/data --defaults-file=$PATHMYSQL/my.cnf, I got the following error:

Installing MySQL system tables...
120521 10:48:32 [Note] Plugin 'FEDERATED' is disabled.
120521 10:48:32 [Note] Plugin 'InnoDB' is disabled.
120521 10:48:32 [ERROR] /home/djeyewater/webapps/mysql/bin/mysqld: unknown option '--skip-bdb'
120521 10:48:32 [ERROR] Aborting

120521 10:48:32 [Note] /home/djeyewater/webapps/mysql/bin/mysqld: Shutdown complete

Installation of system tables failed!

So I restored the old version of mysql, and then read up on all the different mysql install options and the mysql_install_db options. I changed the cmake command for configuring the mysql build slightly, to make sure that the Innobase (Innodb) engine was installed. I hadn't included this previously when installing mysql on my local system, though it still seemed to work okay.

It also seemed that --defaults-file is not a valid option for mysql_install_db, though I don't think including it hurts.

After changing the cmake command, I rebuilt mysql again on my local system, and all was okay. Then I rebuilt it on the server, but still got the same error. After a bit of thinking I realised the problem was probably that I was not specifying the path to the mysql_install_db script of my mysql installation. I tried again with ./scripts/mysql_install_db --basedir=$PATHMYSQL --datadir=$PATHMYSQL/data --defaults-file=$PATHMYSQL/my.cnf (from the mysql dir), and it worked okay. Hip, Hip, Hooray!

And thankfully PHP installed okay and then I got the sites back up and running without any problems (so far).

For part of the afternoon and most of the evening I did some more work on my photo website, starting to change it to HTML5.

No comments: