Starting MySQL daemon


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Starting MySQL daemon
# 1  
Old 12-13-2006
Starting MySQL daemon

I'm running a FreedBSD server with mysql 4.1. When I start mysqld via the command:

# /usr/local/bin/safe_mysqld --user=mysql

it starts the mysql db (I know because the websites are running off of it) but does not return to a prompt, it will let me type but will not respond unless I restart the system. Any ideas on how to resovle this.

Thanks,

Last edited by unispace; 12-13-2006 at 01:32 PM..
# 2  
Old 12-13-2006
I take it you're doing maintenance. Either that or BSD doesn't have an init system?

How about:
Code:
/usr/local/bin/safe_mysqld --user=mysql < /dev/null > /dev/null 2> /dev/null &

This will put it in background, detach it from your console, and prevent it from printing garbage on your screen.
# 3  
Old 12-13-2006
Thanks,

I'm not doing maintenance but I just installed mysql and never configured it to run on init.

I will try that and let you/others know, will have to wait until tonight when my server traffic is less.

Thanks again.
# 4  
Old 12-13-2006
you should edit the /etc/rc.conf and place mysql_enable="YES" in that file, then run /usr/local/etc/rc.d/mysql-server.sh start
# 5  
Old 12-13-2006
I had already added mysql_enable="YES" in /etc/rc.conf but when a enter /usr/local/etc/rc.d/mysql-server.sh start it says "command not found"

By the way there is no file mysql-server.sh but there is mysql-server and substituting that for mysql-server.sh does not work either ("command not found")

Any ideas? All the help is greatly appreciated.
# 6  
Old 12-13-2006
just check the directory listing inside of /usr/local/etc/rc.d and execute the startup script relating to mysql, unless of course you did not install it from ports, if you compiled it by downloading the sources, i don't think the rc script is included.
# 7  
Old 12-13-2006
I didn't install it that is the problem. Someone else can in and set it up and then left the mess for me.

I went to the directory /usr/local/etc/rc.d/ and there is a file mysql-server. I opened it with nano and here are its contents:

Code:
#!/bin/sh
#
# $FreeBSD: ports/databases/mysql323-server/files/mysql-server.sh.in,v 1.3 2006/03/07 16:24:59 ale Exp $
#

# PROVIDE: mysql
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Add the following line to /etc/rc.conf to enable mysql:
# mysql_enable (bool):  Set to "NO" by default.
#                       Set it to "YES" to enable MySQL.
# mysql_limits (bool):  Set to "NO" by default.
#                       Set it to yes to run `limits -e -U mysql`
#                       just before mysql starts.
# mysql_dbdir (str):    Default to "/var/db/mysql"
#                       Base database directory.
# mysql_args (str):     Custom additional arguments to be passed
#                       to mysqld_safe (default empty).
#

. /etc/rc.subr

name="mysql"
rcvar=`set_rcvar`

load_rc_config $name

: ${mysql_enable="NO"}
: ${mysql_limits="NO"}
: ${mysql_dbdir="/var/db/mysql"}
: ${mysql_args=""}

mysql_user="mysql"
mysql_limits_args="-e -U ${mysql_user}"
pidfile="${mysql_dbdir}/`/bin/hostname`.pid"
command="/usr/local/bin/safe_mysqld"
command_args="--defaults-extra-file=${mysql_dbdir}/my.cnf --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile}$
procname="/usr/local/libexec/mysqld"
start_precmd="${name}_prestart"
mysql_install_db="/usr/local/bin/mysql_install_db"
mysql_install_db_args="--ldata=${mysql_dbdir}"

mysql_create_auth_tables()
{
        eval $mysql_install_db $mysql_install_db_args >/dev/null 2>&1
        [ $? -eq 0 ] && chown -R ${mysql_user}:${mysql_user} ${mysql_dbdir}
}

mysql_prestart()
{
        if [ ! -d "${mysql_dbdir}/mysql/." ]; then
                mysql_create_auth_tables || return 1
        fi
        if checkyesno mysql_limits; then
                eval `/usr/bin/limits ${mysql_limits_args}` 2>/dev/null
        else
                return 0
        fi
}

run_rc_command "$1"

Thanks for the help. I guess this is the shell script ran on starting the mysqld?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to grep a line not starting with # from a file (there are two lines starting with # and normal)?

e.g. File name: File.txt cat File.txt Result: #INBOUND_QUEUE=FAQ1 INBOUND_QUEUE=FAQ2 I want to get the value for one which is not commented out. Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies

2. UNIX and Linux Applications

MySQL Daemon failed to start - no mysql.sock file

After doing a yum install mysql mysql-server on Fedora 14 I wasn't able to fully install the packages correctly. It installed MySQL 5.1. I was getting the following error when running the: mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)... (3 Replies)
Discussion started by: jastanle84
3 Replies

3. Shell Programming and Scripting

How to starting process as daemon using ssh command?

Hello, I need to run a command on remote Linux using the ssh command from my local machine. I am able to execute the command on remote machine using ssh but it's behaving strangely. The command is supposed to start a daemon process on remote linux box and the control should return back to me... (5 Replies)
Discussion started by: nitinshukla
5 Replies

4. SCO

Stoping & starting the cron daemon

Hi We are running SCO ver 5. Recently the cron daemon stopped running on its own. How do I find out why? How do I restart/stop it? I typed cron but it didn't work. Will rebooting it do the trick or can I manually start and stop the cron daemon? Please help. Thanks & Regards. (0 Replies)
Discussion started by: othman
0 Replies

5. Solaris

Problems starting apache 1.3 with mysql

I've been working on a project to replace one of the my group's primary NIS servers. It also runs mysql and apache, as it is the host for the our team's hardware tracking database and website. Its running apache 1.3, and for some odd reason, I can't get apache to start on system boot. The... (1 Reply)
Discussion started by: godspunk32
1 Replies

6. Linux

mysql not starting with fedora linux

Hi... I have installed mysql in Fedora and when i tried to start mysql the error i get was "Asked for 196608 thread stack" What might be the problem???? I have tried all ways but doesnt work out........ (1 Reply)
Discussion started by: arunkumar_mca
1 Replies
Login or Register to Ask a Question