Bug #30640 mysql.server.sh: line 247, 256: @HOSTNAME@: command not found
Submitted: 26 Aug 2007 11:30 Modified: 27 Aug 2007 6:52
Reporter: Mike N Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.0.45 OS:Linux
Assigned to: CPU Architecture:Any
Tags: startup script error hostname command not found

[26 Aug 2007 11:30] Mike N
Description:
mysql.server.sh: line 247: @HOSTNAME@: command not found
mysql.server.sh: line 256: @HOSTNAME@: command not found

when running the mysql.server.sh script just after installing a new copy of mysql 5.0.45, I encountered this error.

mysql.server.sh:247: pid_file=$datadir/mysqlmanager-`@HOSTNAME@`.pid

mysql.server.sh:256: server_pid_file=$datadir/`@HOSTNAME@`.pid

How to repeat:
I compiled the server from source with custom file paths, etc:

CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/server/mysql/mysql-5.0.45 --enable-shared --enable-static --enable-assembler --with-low-memory --with-charset=utf8 --with-collation=utf8_general_ci --with-openssl=/usr/server/openssl/openssl-0.9.8e --with-mysqlmanager --with-ndbcluster --with-federated-storage-engine --with-archive-storage-engine --with-csv-storage-engine
make
make install
ln -s /usr/server/openssl/openssl-0.9.8e/lib/libssl.so.0.9.8 /lib64/libssl.so.0.9.8
ln -s /usr/server/openssl/openssl-0.9.8e/lib/libcrypto.so.0.9.8 /lib64/libcrypto.so.0.9.8
cd /usr/server/mysql/mysql-5.0.45
chown -R root:root .
chown -R mysql:mysql var
cp ~/Desktop/mysql-5.0.45/support-files/mysql.server.sh /etc/init.d/
ln -s /etc/init.d/mysql.server.sh /etc/rc0.d/K01MySQL
ln -s /etc/init.d/mysql.server.sh /etc/rc3.d/S99MySQL
chmod 755 /etc/init.d/mysql.server.sh

my.cnf:

had to add config for mysqlmanager because I enabled this option during compile, and dont know how to trick mysql.server.sh into forgetting that I have mysqlmanager set up, and dont really care, I realized running with mysqld and mysqld_safe worked just fine, so i realized i had to add config for instance manager, after stumbling around the mysql site for a good hour, i found that if mysqlmanager is being used theres a whole bunch of stuff you have to do:

[manager]
default-mysqld-path = /usr/server/mysql/mysql-5.0.45/libexec/mysqld
socket = /usr/server/mysql/mysql-5.0.45/var/manager.sock
pid-file = /usr/server/mysql/mysql-5.0.45/var/manager.pid
password-file = /etc/mysqlmanager.passwd
monitoring-interval = 2
port = 1999
bind-address = 192.168.1.200

libexec/mysqlmanager --passwd >> /etc/mysqlmanager.passwd

after I did this, AND fix the code of mysql.server.sh, I was able to start up mysql using mysqlmanager, with my custom config. 

also I would like to know if you can make it so that it doesnt look in /lib64/ for libssl.so.0.9.8 and libcrypto.so.0.9.8, seeing as how I told it to look in /usr/server/openssl/openssl-0.9.8e for openssl, not /lib64/. if someone can send me a message or post on here or something as to why that is happening I would also appreciate it, although that is not the focus of this bug report.

I looked to see if this bug had been reported elsewhere, but it had not as far as i saw, but the bug report search is not useful when you dont know what category to search in, and not picking a category yields 1200 results, none of which are relevant to the keywords that i entered.

Anyways in closing, I would just like to explain my reasoning in doing a custom compile in the first place:

i am an intermediate user of linux, and last time i tried to update openssl to 0.9.8e, my server stopped booting and i had to use rpm to uninstall and reinstall it in runlevel 3 because X would no longer start because i wrecked some dependencies by installing a newer openssl version into the 'proper' file locations. So I decided to put all my apache/php/mysql/openssl/etc into a common folder somewhere, didnt like the names of any of the other folders in /usr, so i made my own and put everything in there. Also, I wanted to be able to turn on all those other nifty options, so I did not want to use an RPM. 

I did not expect to come across so many damn problems, as this is like the 10th time i have tried installing openssl and mysql together into non standard locations and the first time i have managed to get it to work. I have to say I am really displeased in general with my experiences thus far trying to do what seems to me to be something trivially different from what several people in the past have probably done before and either failed or succeeded at. My troubles getting MySQL to work in a custom compile on linux are the main reason why my webserver still runs on windows server 2003. I REALLY dont like having to change source code to get things to work, and although this bug seems kind of small, if it gets incorporated into a coming release, its maybe at LEAST a dozen fewer people who get frustrated trying to compile mysql and give up.

Suggested fix:
there are no backtick quotes around anything else in mysql.server aside from what are obvious system commands being run. These two lines just need the backtick quotes removed:

mysql.server.sh:247: pid_file=$datadir/mysqlmanager-`@HOSTNAME@`.pid

mysql.server.sh:256: server_pid_file=$datadir/`@HOSTNAME@`.pid

become:

mysql.server.sh:247: pid_file=$datadir/mysqlmanager-@HOSTNAME@.pid

mysql.server.sh:256: server_pid_file=$datadir/@HOSTNAME@.pid

and then it works.
[27 Aug 2007 6:52] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

mysql.server.sh is just template for mysql.server script. All variables like @HOSTNAME@ will be converted during compilation. Please use mysql.server instead.