Bug #7873 changing basedir variable in mysql.server script doesn't take an effect
Submitted: 13 Jan 2005 13:33 Modified: 17 Feb 2005 18:19
Reporter: Gleb Paharenko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.8 OS:Linux (Linux)
Assigned to: Jani Tolonen CPU Architecture:Any

[13 Jan 2005 13:33] Gleb Paharenko
Description:
Changing basedir variable in mysql.server script doesn't take an effect.

How to repeat:
Set the basedir to exact location:
[gleb@toyou mysql-debug-5.0.2-alpha-pc-linux-i686]$ diff -C 2 support-files/mysql.server support-files/mysql.server.1
*** support-files/mysql.server  Thu Jan 13 14:42:47 2005
--- support-files/mysql.server.1        Thu Jan 13 15:32:36 2005
***************
*** 40,44 ****
  # in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.

! basedir=

  # The following variables are only set for letting mysql.server find things.
--- 40,44 ----
  # in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.

! basedir=/home/gleb/mysqls/mysql-debug-5.0.2-alpha-pc-linux-i686

  # The following variables are only set for letting mysql.server find things.

Run the script:
  [gleb@toyou mysql-debug-5.0.2-alpha-pc-linux-i686]$ ./support-files/mysql.server.1 stop
/usr/local/mysql/data
No mysqld pid file found. Looked for /usr/local/mysql/data/toyou.ensita.net.pid.

  

Suggested fix:
The clue in that datadir doesn't automatically changes after updating the 
basedir.

My patch is:
  
*** support-files/mysql.server  Thu Jan 13 14:42:47 2005
--- support-files/mysql.server.new      Thu Jan 13 14:48:48 2005
***************
*** 49,60 ****
--- 49,61 ----
  if test -z "$basedir"
  then
    basedir=/usr/local/mysql
    bindir=./bin
  else
    bindir="$basedir/bin"
+       datadir="$basedir/data"
  fi

  PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
  export PATH

  mode=$1    # start or stop
[17 Feb 2005 13:09] Jani Tolonen
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html
[17 Feb 2005 18:19] Jani Tolonen
Changed script so, that datadir is set to default, only if basedir is empty.
If basedir is set, also datadir must be set. The problem with setting datadir
automatically according to basedir, the result may be wrong. The datadir
may end with /data or /var subdirs, depending on distribution.