Re: Start Mysql on system boot from a non-standard directory (205 Views)
Reply
Occasional Advisor
spirit986
Posts: 17
Registered: ‎11-22-2011
Message 1 of 6 (268 Views)

Start Mysql on system boot from a non-standard directory

[ Edited ]

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
Please use plain text.
Honored Contributor
Patrick Wallek
Posts: 13,758
Registered: ‎06-21-2000
Message 2 of 6 (250 Views)

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 .

 

 

Please use plain text.
Occasional Advisor
spirit986
Posts: 17
Registered: ‎11-22-2011
Message 3 of 6 (231 Views)

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

[ Edited ]

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
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 25,001
Registered: ‎03-06-2006
Message 4 of 6 (227 Views)

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?

Please use plain text.
Occasional Advisor
spirit986
Posts: 17
Registered: ‎11-22-2011
Message 5 of 6 (222 Views)

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

[ Edited ]

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
Please use plain text.
Honored Contributor
Matti_Kurkela
Posts: 6,271
Registered: ‎12-02-2001
Message 6 of 6 (205 Views)

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
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation