Operating System - HP-UX
1748265 Members
4059 Online
108760 Solutions
New Discussion

Re: Start Mysql on system boot from a non-standard directory

 
spirit986
Occasional Advisor

Start Mysql on system boot from a non-standard directory

I've set up a mysql server on HP-UX for a client, however the client wanted mysql to be installed in /mysq instead in the default directory /usr/local/mysql.

 

Everything is running fine, except that little fact that I need to set the daemon to start on server boot time. There is a very little explanation in the /mysql/support-files/mysql.server file since this file has been created as a general guideline for all UNIX/LINUX systems.

 

When the server boots up there is a list of processes that are starting with it:

Start MySQL Server .................................................. OK

However when i try:

# ps -ef

 

to see a list of proccesses running on the system, mysql isn't there...

 

So I have to start the daemon and the server manualy:

# cd /mysql
# ./bin/safe_mysqld --user=root & [1] 3847 # Starting mysqld daemon with databases from /mysql/data # # ./support-files/mysql.server start Starting MySQL SUCCESS! # # ps -ef | grep -i mysql root 3847 1965 0 13:25:06 pts/0 0:00 /bin/sh ./bin/safe_mysqld --user=root root 3867 3847 0 13:25:06 pts/0 0:00 /mysql/bin/mysqld --basedir=/mysql --datadir=/mysql/data --u root 3961 1965 0 13:26:40 pts/0 0:00 grep -i mysql # #

 

Does anyone know how can I force the mysql daemon and the mysql server to start when the system boots up?

MCP
5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: Start Mysql on system boot from a non-standard directory

Check the script in /sbin/init.d that starts MySQL.  Look there for any paths that may be set to point to /usr/local/mysql and point them to /mysql.

 

The other option is to link /usr/local/mysql to /mysql and see if that will work.

 

# cd /usr/local

# ln -s /mysql .

 

 

spirit986
Occasional Advisor

Re: Start Mysql on system boot from a non-standard directory

Already checked in /sbin/init.d there is a script mysql.server where I put the parametars folowing the instructions in the same file:

basedir=/mysql
datadir=/mysql/data

 Also in /etc/my.cnf I updated the mysqld location:

[mysqld]
basedir=/mysql

 And still when the server starts is is giving info that it starts the mysqldaemon but on when i try

ps -ef | grep -i mysql the mysql processes are not listed.

 

I am thinking diferently now.. is there a way to create some sort of a startup script to execute the folowing comands on startup:

 

# cd /mysql
# ./bin/safe_mysqld --user=root &
# ./support-files/mysql.server start

 

MCP
Dennis Handly
Acclaimed Contributor

Re: Start Mysql on system boot from a non-standard directory

>is there a way to create some sort of a startup script to execute the following commands on startup:


Just edit mysql.server and put it there?

Is there a symlink in one of the /sbin/rc#.d/ directories to mysql.server?

spirit986
Occasional Advisor

Re: Start Mysql on system boot from a non-standard directory

There are four lc#.d directories located in /sbin/. Here's the output when searching for links to mysql.server.

 

# ls -l /sbin/rc0.d | grep -i mysql
# ls -l /sbin/rc1.d | grep -i mysql
# ls -l /sbin/rc2.d | grep -i mysql
lrwxrwxrwx   1 root       sys             25 Jul 28 14:11 K700mysql.server -> /sbin/init.d/mysql.server
# ls -l /sbin/rc3.d | grep -i mysql
lrwxrwxrwx   1 root       sys             25 Jul 28 14:11 S700mysql.server -> /sbin/init.d/mysql.server
# ls -l /sbin/rc4.d | grep -i mysql

And as i said I've configured mysql.server file according to the instructions inside it.

 

# If you install MySQL on some other places than /usr/local/mysql, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
#   [mysqld]
#   basedir=<path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
#   and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
#   below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.

# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.

basedir=/mysql
datadir=/mysql/data

 

MCP
Matti_Kurkela
Honored Contributor

Re: Start Mysql on system boot from a non-standard directory

Start MySQL Server .................................................. OK

 This only means the script was invoked and did not return an error code. You should look at /etc/rc.log to see if any error messages were produced by mysql and/or the mysql.server script.

MK