Installing Mysql server on a ReadyNAS duo

By Stephane Carrez 8 comments

Being able to connect to my ReadyNAS duo using SSH (See Connecting to a ReadyNAS duo using SSH), the next step for setting up a Bacula backup solution was to setup a MySQL server. Th

Installing the APT extension

The ReadyNAS duo runs a Debian Sarge distribution. The apt-get commands are not available and we must install the APT addon:

  1. Download the APT extension. I've used the following link:

http://www.readynas.com/download/addons/4.00/APT_1.0.bin

  1. Go in the ReadyNAS FrontView with your browser and go to System -> Update -> Local Update
  2. Upload the APT binary file. The ReadyNAS verifies that content and if it is correct it displays a description of the addon.
  3. Acknowledge the installation of the addon

After installation, the ReadyNAS must be restarted. Shortly after, you will receive an email:

Subject: Addon Package Progress (nas-XX-XX-XX)
Successfully installed APT.

Debian Sarge Package update

It may be good to check the debian packages. Connect to the ReadyNAS using ssh and run the following commands:

apt-get update

Installation of Mysql server

The mysql-server-5.0 is supposed to be installed according to dpkg -i command. However, the files are not there and they have probably be removed. This is also the case for some utilities which are used by some installation scripts.

Preparation

The /usr/bin/chfn utility is missing and we need it for Mysql installation. We must re-install the passwd package. Download it and install it as follows;

# dpkg -i passwd_4.0.3-31sarge9_sparc.deb

The /usr/bin/logger is also missing. We must re-install the bsdutils_2.12p-4sarge2_sparc.deb package. Download it and install it as follows:

# dpkg -i bsdutils_2.12p-4sarge2_sparc.deb

Edit the /etc/mysql/my.cnf file and change the line:

user            = admin

into

user           = mysql

Additional packages

As reported by RoB (see comments), the following packages are also necessary for mysql-server:

# apt-get install libreadline5 libdbi-perl

Get Mysql packages

The mysql packages are part of backports.org (backport from Etch). You should download the following:

Mysql installation

Install the Mysql server debian packages:

# dpkg -i libmysqlclient15off_5.0.32-7etch5~bpo31+1_sparc.deb \
mysql-common_5.0.32-7etch5~bpo31+1_all.deb  \
mysql-server-5.0_5.0.32-7etch5~bpo31+1_sparc.deb \
mysql-client-5.0_5.0.32-7etch5~bpo31+1_sparc.deb \
mysql-client_5.0.32-7etch5~bpo31+1_all.deb
Installation Problem and Solution

If in the installation process you see a message '/etc/init.d/mysql' not found, force the extraction of mysql-server files without the execution of the installation script:

# dpkg --extract mysql-server-5.0_5.0.32-7etch5~bpo31+1_sparc.deb /

After that, redo the dpkg -i command.

If you see some errors in the logs:

[ERROR] /usr/sbin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)

Fix ownership of some existing directories:

# chown mysql /var/lib/mysql
# chown mysql /var/lib/mysql/mysql

and restart mysql

Fix /etc/mysql/debian.cnf

After installation, the debian.cnf file used by mysqlcheck uses a user that does not exist. You can either create the debian-sys-maint user in mysql or change it to 'root' by editing the file /etc/mysql/debian.cnf and change user and password to use 'root'.

Fix startup scripts

Remove the following two startup scripts, they are not necessary for us:

  1. rm /etc/rc2.d/S18mysql-ndb
  2. rm /etc/rc2.d/S17mysql-ndb-mgm

Testing the database

Verify that the Mysql database is running:

nas-D2-24-F2:/var/log# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.32-Debian_7etch5~bpo31+1 Debian etch distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>    

Add a comment

To add a comment, you must be connected. Login

8 comments

necochino@yahoo.com
necochino on 2012-03-16 07:27:18 said:

I've tried several times to follow your instructions (I want to upgrade from v4.0 to v5.0 this way). I do get error messages. None of the packages in the dpkg -i are found. It appears that the versions available are different? Not very familiar with these commands, unfortunately. Marko appears to have been able to install less than two months ago. I must be doing something wrong...

marko@protestdesign.fi
Marko on 2011-12-31 14:33:04 said:

Hi,
I have followed your instructions but seem to have a problem with "unknown initscript". Is this due to missing some files in /etc/init.d/mysql?

Preparing to replace mysql-server-5.0 5.0.32-7etch5~bpo31+1 (using mysql-server-5.0_5 .0.32-7etch5~bpo31+1_sparc.deb) ...
invoke-rc.d: unknown initscript, /etc/init.d/mysql not found.
invoke-rc.d: unknown initscript, /etc/init.d/mysql not found.
Unpacking replacement mysql-server-5.0 ...
dpkg: mysql-server-5.0: warning - conffile `etc/init.d/mysql' is not a plain file or symlink (= `/etc/init.d/mysql')

Setting up mysql-server-5.0 (5.0.32-7etch5~bpo31+1) ...
dpkg: mysql-server-5.0: warning - conffile `/etc/init.d/mysql' is not a plain file or symlink (= `/etc/init.d/mysql')
invoke-rc.d: unknown initscript, /etc/init.d/mysql not found.
update-rc.d: /etc/init.d/mysql: file does not exist
dpkg: error processing mysql-server-5.0 (--install):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:

nigel_gossage@yahoo.co.uk
Nigel on 2011-11-13 08:21:44 said:

First time using SSH so I'm not finding this too easy...

"The /usr/bin/chfn utility is missing and we need it for Mysql installation. We must re-install the passwd package. Download it and install it as follows..."

I've downloaded the file but where (and how) do I put it somewhere so the "dpkg -i passwd_4.0.3-31sarge9_sparc.deb" command will pick it up?

Thanks for the tutorial btw, I'm trying to get XBMC to run on a centralized database.

ga@master.org.uk
Graham on 2010-03-07 09:09:46 said:

Is there a way to remove the installation of MySQL ?

gwils30@googlemail.com
admin4 on 2009-09-27 09:13:16 said:

After following this post I now get the following when starting mysql 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!, please tell me how this can be resolved,

Gary

will.powell@iee.org
Will on 2009-09-01 20:40:15 said:

Again thanks for making this available. Works for me - one step missing though: in the "Additional Packages" section add also:

# apt-get install libmysqlclient12 libdbd-mysql-perl

Took me an extra couple of minutes to realise that I needed these both on the same line. Then I had the missing init.d/mysql issue (thanks for the --extract line!)

Installation wasn't too painful with this step-by-step with all those links. Thanks again.

rdimeonj@hotmail.com
RoB on 2009-05-18 00:13:50 said:

First off, thank you for responding so quickly! I checked the “/proc/cpuinfo” file and verified that I do have the correct CPU version.

I am very new to working with SSH and setting up MySQL. I did quite a bit of researching to get myself to understand each of the steps. After I posted yesterday, I was able to get to the “Mysql installation” step. However I got the following messages when installing this files mysql-server-5.0_5.0.32-7etch5~bpo31+1_sparc.deb, mysql-client-5.0_5.0.32-7etch5~bpo31+1_sparc.deb, and mysql-client_5.0.32-7etch5~bpo31+1_all.deb.

--------Error Messages-------
pkg: dependency problems prevent configuration of mysql-server-5.0:
mysql-server-5.0 depends on mysql-client-5.0 (>= 5.0.32-7etch5~bpo31+1); however:
Package mysql-client-5.0 is not configured yet.
mysql-server-5.0 depends on libdbi-perl; however:
Package libdbi-perl is not installed.
mysql-server-5.0 depends on libreadline5; however:
Package libreadline5 is not installed.
dpkg: error processing mysql-server-5.0 (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-5.0

-----end------

Also, I believe it is important to explain why I would like to install mySQL on the Readynas in the first place. I am setting it up to work with a Radio Station Automation Software that catalogs music in a database. The music files are easily stored and played off the ReadyNAS. However, a database is needed to store the artist, title, and a great deal of other information.

All-in-all, the station is very small but it has a few thousand of individual music titles that it will need to catalog and referred to, as well as the programming schedule.

Is this too much to for the Readynas to handle? Also once MySQL is installed, where is the software stored?

Thanks for your help!

rdimeonj@hotmail.com
RoB on 2009-05-16 19:22:50 said:

Hi there thank you so much for making this information available, however for beginners this is a huge task to undertake. Would you or anyone in the community be able to fill in the blanks where beginners might run into a brick wall. For me, as soon as we got to the “Installation of Mysql server" section, I was unable to install the needed files. HELP =0)