error 2002 can't connect to local mysql server through socket

After installing mysql5.5.5 on freebsd8.0 I try the following
# mysql -u root
I get
Code:
error 2002 can't connect to local mysql server through socket '/tmp/mysql.sock'
Please I need help to go ahead.
 
Add to /etc/rc.conf:
Code:
mysql_enable="YES"

And start it # /usr/local/etc/rc.d/mysql-server.sh start or reboot.
 
I have added the line
Code:
mysql_enable="YES"
in /etc/rc.conf and rebooted the server and I am getting the same error still.
I try running /usr/local/etc/rc.d/mysql-server.sh start but I got error
Code:
/usr/local/etc/rc.d/mysql-server.sh: command not found
but when I tried [cmd=]/usr/local/etc/rc.d/mysql-server[/cmd] start it showed
starting mysql.
I do not know what is wrong here
 
Ok. I did it from the top of my head. Read the rc script, it will show what exactly to set in rc.conf to enable this particular version.
 
The .sh extension of rc.d scripts has long been a thing of the past, no?
 
Look at your my.cnf where your socket file is configured (line "socket = ..."). If it's not /tmp/mysql.sock use "-S" parameter. For example:

Code:
msql -u root -S /var/db/mysql/mysql.sock

If it should be at for example /tmp/mysql.sock but it's not after you started the deamon, look in /var/db/mysql/MACHINEHOSTNAME.err by default for errors.
 
more /var/db/mysql/MACHINEHOSTNAME.err does not produce anything to assist in troubleshooting the problem.
 
enweniwe said:
more /var/db/mysql/MACHINEHOSTNAME.err does not produce anythin to assist in troubleshooting the problem.

You must replace "MACHINEHOSTNAME" with your hostname. Run command

hostname

to see what it is, if you don't know. Or just search any *.err in /var/db/mysql.
 
thanks pbd. This are my /etc/rc.conf
Code:
# -- sysinstall generated deltas -- # Wed Jul 28 15:15:42 2010
# Created: Wed Jul 28 15:15:42 2010
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
defaultrouter="192.168.15.220"
gateway_enable="YES"
hostname="machinehostname"
ifconfig_bge0="DHCP"
keymap="us.iso"
# -- sysinstall generated deltas -- # Thu Jul 29 07:56:00 2010
sendmail_enable="YES"
devfs_system_ruleset="localrules"
mysql_enable="YES"
mysql_enable="YES"
# -- sysinstall generated deltas -- # Tue Aug  3 10:29:55 2010
hostname="machinehostname"
# -- sysinstall generated deltas -- # Tue Aug  3 14:24:44 2010
defaultrouter="192.168.15.220"
hostname="machinehostname"
# -- sysinstall generated deltas -- # Tue Aug  3 16:03:53 2010
ifconfig_bge0="DHCP"
hostname="machinehostname"

and /usr/local/etc/rc.d/mysql-server below

Code:
#!/bin/sh
#
# $FreeBSD: ports/databases/mysql55-server/files/mysql-server.sh.in,v 1.8 2010/03/27 00:12:47 dougb 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/mysqld_safe"
command_args="--defaults-extra-file=${mysql_dbdir}/my.cnf --user=${mysql_user} --datadir=${mysql_dbdir} --pid-file=${pidfile} ${mysql_args} > /dev/null 2>&1 &"
procname="/usr/local/libexec/mysqld"
start_precmd="${name}_prestart"
start_postcmd="${name}_poststart"
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>/dev/null
        [ $? -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
}

mysql_poststart()
{
	local timeout=15
	while [ ! -f "${pidfile}" -a ${timeout} -gt 0 ]; do
		timeout=$(( timeout - 1 ))
		sleep 1
	done
	return 0
}

run_rc_command "$1"
 
Use
Code:
 tags for output, not [quote] tags! 
[url=http://forums.freebsd.org/showthread.php?t=8816]http://forums.freebsd.org/showthread.php?t=8816[/url]
 
Find below /var/db/mysql/*.err
Code:
100804 12:19:45 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
100804 12:19:45 [Note] Buffered information: Performance schema disabled (reason: start parameters).

100804 12:19:45 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
100804 12:19:45  InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
100804 12:19:45  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
100804 12:19:45  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
100804 12:19:46 InnoDB 1.1.1 started; log sequence number 0
/usr/local/libexec/mysqld: Too many arguments (first extra is '.pid').
Use --verbose --help to get a list of available options
100804 12:19:46 [ERROR] Aborting

100804 12:19:46  InnoDB: Starting shutdown...
100804 12:19:51  InnoDB: Shutdown completed; log sequence number 1595675
100804 12:19:51 [Note] /usr/local/libexec/mysqld: Shutdown complete

100804 12:19:51 mysqld_safe mysqld from pid file /var/db/mysql/machinehostname ended
100804 14:01:04 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
100804 14:01:05 [Note] Buffered information: Performance schema disabled (reason: start parameters).

100804 14:01:05 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
100804 14:01:05  InnoDB: highest supported file format is Barracuda.
100804 14:01:06 InnoDB 1.1.1 started; log sequence number 1595675
/usr/local/libexec/mysqld: Too many arguments (first extra is '.pid').
Use --verbose --help to get a list of available options
100804 14:01:06 [ERROR] Aborting

100804 14:01:06  InnoDB: Starting shutdown...
100804 14:01:11  InnoDB: Shutdown completed; log sequence number 1595675
100804 14:01:11 [Note] /usr/local/libexec/mysqld: Shutdown complete

100804 14:01:11 mysqld_safe mysqld from pid file /var/db/mysql/machinehostname ended
100804 14:04:49 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
100804 14:04:49 [Note] Buffered information: Performance schema disabled (reason: start parameters).

100804 14:04:49 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
100804 14:04:49  InnoDB: highest supported file format is Barracuda.
100804 14:04:49 InnoDB 1.1.1 started; log sequence number 1595675
/usr/local/libexec/mysqld: Too many arguments (first extra is '.pid').
Use --verbose --help to get a list of available options
100804 14:04:49 [ERROR] Aborting

100804 14:04:49  InnoDB: Starting shutdown...
100804 14:04:54  InnoDB: Shutdown completed; log sequence number 1595675
100804 14:04:54 [Note] /usr/local/libexec/mysqld: Shutdown complete

100804 14:04:54 mysqld_safe mysqld from pid file /var/db/mysql/machinehostname ended
100804 15:05:05 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
100804 15:05:05 [Note] Buffered information: Performance schema disabled (reason: start parameters).

100804 15:05:05 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
100804 15:05:05  InnoDB: highest supported file format is Barracuda.
100804 15:05:05 InnoDB 1.1.1 started; log sequence number 1595675
/usr/local/libexec/mysqld: Too many arguments (first extra is '.pid').
Use --verbose --help to get a list of available options
100804 15:05:05 [ERROR] Aborting

100804 15:05:05  InnoDB: Starting shutdown...
100804 15:05:11  InnoDB: Shutdown completed; log sequence number 1595675
100804 15:05:11 [Note] /usr/local/libexec/mysqld: Shutdown complete

100804 15:05:11 mysqld_safe mysqld from pid file /var/db/mysql/machinehostname ended
 
It seems the rc script starts mysql with a few options that aren't supported anymore (like --pid-file). This should be reported to the port's maintainer.

Is there any particular reason you want MySQL 5.5.x?
I stongly recommend installing either 5.0.x or 5.1.x. instead. A lot of ports don't support 5.5.x.
 
I have installed mysql51-server but I am still having the same issue
I tried locating with
Code:
find / -name my.cnf 
find / -name mysql.sock
and they are not in the system. Please help.
 
I have installed mysql51-server but I am still having the same issue
I tried locating with
Code:
find / -name my.cnf 
find / -name mysql.sock
and they are not in the system. Please help
 
There is no my.cnf by default. And not having a mysql.sock means the server isn't running.
 
You never started the server!

# /usr/local/etc/rc.d/mysql start
 
enweniwe said:
/var/db/mysql/*.err
Code:
100804 12:19:45 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql
100804 12:19:45 [Note] Buffered information: Performance schema disabled (reason: start parameters).
100804 12:19:45 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
[....]
100804 15:05:05 [ERROR] Aborting
100804 15:05:05  InnoDB: Starting shutdown...
100804 15:05:11  InnoDB: Shutdown completed; log sequence number 1595675
100804 15:05:11 [Note] /usr/local/libexec/mysqld: Shutdown complete
100804 15:05:11 mysqld_safe mysqld from pid file /var/db/mysql/relay.visafone.com.ng ended

Is this the new .err file after you installed mysql 5.1? It looks like the old one from 5.5.

What version do you use?

# /usr/local/libexec/mysqld --version
 
pbd said:
Is this the new .err file after you installed mysql 5.1? It looks like the old one from 5.5.
It's the old one. Look at the date/time stamp. Compare that with the previously posted .err file.
 
Back
Top