View Full Version : MySQL Error
DazzyB
10th August 2007, 15:57
I'm having issues with MySQL... I have installed Ubuntu Dapper LAMP Server and after installation MySQL works, then I setup my Hosts file and networking etc... and after I restart I get this:
root@mail:~# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
root@mail:~#
I have re-installed 3 times already, and been up and down google and I have yet to find an answer, can anyone help?
falko
11th August 2007, 12:40
What's the output of netstat -tap and ps aux | grep mysql?
What's in /etc/mysql/my.cnf?
DazzyB
11th August 2007, 12:59
netstat -tap:
root@carterweb:/opt/zcs# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 carterweb.za.net:390 *:* LISTEN 6124/slapd
tcp 0 0 localhost:10024 *:* LISTEN 8677/amavisd (maste
tcp 0 0 localhost:10025 *:* LISTEN 8711/master
tcp 0 0 localhost:7306 *:* LISTEN 7239/mysqld
tcp 0 0 *:mysql *:* LISTEN 3851/mysqld
tcp 0 0 localhost:7307 *:* LISTEN 7436/mysqld
tcp 0 0 *:3310 *:* LISTEN 8633/clamd
tcp 0 0 *:10000 *:* LISTEN 4060/perl
tcp 0 0 *:ssmtp *:* LISTEN 8711/master
tcp 0 0 carterweb.za.net:domain *:* LISTEN 3753/named
tcp 0 0 localhost:domain *:* LISTEN 3753/named
tcp 0 0 *:3128 *:* LISTEN 3988/(squid)
tcp 0 0 *:smtp *:* LISTEN 8711/master
tcp 0 0 localhost:953 *:* LISTEN 3753/named
tcp 0 0 carterweb.za.net:51150 fk-in-f166.google.c:www ESTABLISHED3988/(squid)
tcp 0 0 carterweb.za.net:59796 mu-in-f147.google.c:www ESTABLISHED3988/(squid)
tcp 0 0 carterweb.za.net:3128 192.168.1.3:1690 ESTABLISHED3988/(squid)
tcp 0 0 carterweb.za.net:3128 192.168.1.3:1691 TIME_WAIT -
tcp 0 0 carterweb.za.net:3128 192.168.1.3:1689 ESTABLISHED3988/(squid)
tcp 0 0 carterweb.za.net:3128 192.168.1.3:1687 ESTABLISHED3988/(squid)
tcp 0 0 localhost:7306 localhost:58247 ESTABLISHED7239/mysqld
tcp 0 0 carterweb.za.net:50771 bu-in-f93.google.co:www TIME_WAIT -
tcp 0 0 carterweb.za.net:34625 fg-in-f99.google.co:www ESTABLISHED3988/(squid)
tcp 0 0 carterweb.za.net:47478 atlanta.directroute:www TIME_WAIT -
tcp 0 0 localhost:7306 localhost:33021 ESTABLISHED7239/mysqld
tcp6 0 0 *:imaps *:* LISTEN 9947/java
tcp6 0 0 *:pop3s *:* LISTEN 9947/java
tcp6 0 0 *:7780 *:* LISTEN 8636/httpd
tcp6 0 0 *:pop3 *:* LISTEN 9947/java
tcp6 0 0 *:imap2 *:* LISTEN 9947/java
tcp6 0 0 *:www *:* LISTEN 4034/apache2
tcp6 0 0 *:7025 *:* LISTEN 9947/java
tcp6 0 0 *:85 *:* LISTEN 9947/java
tcp6 0 0 *:ssh *:* LISTEN 3931/sshd
tcp6 0 0 ip6-localhost:953 *:* LISTEN 3753/named
tcp6 0 0 *:7035 *:* LISTEN 9947/java
tcp6 0 0 *:7071 *:* LISTEN 9947/java
tcp6 0 0 localhost:33021 localhost:7306 ESTABLISHED9947/java
tcp6 0 0 ip6-localhost:34200 ip6-localhost:41867 TIME_WAIT -
tcp6 0 0 carterweb.za.net:41799 carterweb.za.net:390 TIME_WAIT -
tcp6 0 0 carterweb.za.net:41800 carterweb.za.net:390 TIME_WAIT -
tcp6 0 0 carterweb.za.net:41801 carterweb.za.net:390 TIME_WAIT -
tcp6 0 0 carterweb.za.net:41802 carterweb.za.net:390 TIME_WAIT -
tcp6 0 0 carterweb.za.net:41803 carterweb.za.net:390 TIME_WAIT -
tcp6 0 0 ip6-localhost:42150 ip6-localhost:57244 TIME_WAIT -
tcp6 0 0 localhost:58247 localhost:7306 ESTABLISHED9947/java
tcp6 0 0 ip6-localhost:41695 ip6-localhost:60520 TIME_WAIT -
tcp6 0 2008 carterweb.za.net:ssh ::ffff:192.168.1.3:1274 ESTABLISHED4097/0
ps aux | grep mysql:
root@carterweb:/opt/zcs# ps aux | grep mysql
root 3799 0.0 0.1 2636 1312 ? S 10:57 0:00 /bin/sh /usr/bin/mysqld_safe
mysql 3851 0.0 2.4 126988 18260 ? Sl 10:57 0:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
root 3852 0.0 0.0 1552 504 ? S 10:57 0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
zimbra 7198 0.0 0.2 3000 1496 pts/0 S 11:04 0:00 /bin/sh /opt/zimbra/mysql/bin/mysqld_safe --defaults-file=/opt/zimbra/conf/my.cnf --ledir=/opt/zimbra/mysql/libexec
zimbra 7239 0.0 4.5 265884 33752 pts/0 Sl 11:04 0:02 /opt/zimbra/mysql/libexec/mysqld --defaults-file=/opt/zimbra/conf/my.cnf --basedir=/opt/zimbra/mysql --datadir=/opt/zimbra/db/data --pid-file=/opt/zimbra/db/mysql.pid --skip-external-locking --port=7306 --socket=/opt/zimbra/db/mysql.sock
zimbra 7402 0.0 0.2 2996 1496 pts/0 S 11:05 0:00 /bin/sh /opt/zimbra/logger/mysql/bin/mysqld_safe --defaults-file=/opt/zimbra/conf/my.logger.cnf --ledir=/opt/zimbra/logger/mysql/libexec
zimbra 7436 0.0 2.1 92032 15672 pts/0 Sl 11:05 0:00 /opt/zimbra/logger/mysql/libexec/mysqld --defaults-file=/opt/zimbra/conf/my.logger.cnf --basedir=/opt/zimbra/logger/mysql --datadir=/opt/zimbra/logger/db/data --pid-file=/opt/zimbra/logger/db/mysql.pid --skip-external-locking --port=7307 --socket=/opt/zimbra/logger/db/mysql.sock
root 14918 0.0 0.1 2880 812 pts/0 S+ 11:57 0:00 grep mysql
/etc/mysql/my.cnf:
#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "/var/lib/mysql/my.cnf" to set server-specific options or
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
#[mysqld_safe]
#socket = /var/run/mysqld/mysqld.sock
#nice = 0
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
#
# For compatibility to other Debian packages that still use
# libmysqlclient10 and libmysqlclient12.
old_passwords = 1
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
#
# * Query Cache Configuration
#
query_cache_limit = 1048576
query_cache_size = 16777216
query_cache_type = 1
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log = /var/log/mysql.log
#log = /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log-slow-queries = /var/log/mysql/mysql-slow.log
#
# The following can be used as easy to replay backup logs or for replication.
#server-id = 1
log-bin = /var/log/mysql/mysql-bin.log
expire-logs-days = 20
max_binlog_size = 104857600
#binlog-do-db = include_database_name
#binlog-ignore-db = include_database_name
#
# * BerkeleyDB
#
# According to an MySQL employee the use of BerkeleyDB is now discouraged
# and support for it will probably cease in the next versions.
skip-bdb
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# If you want to enable SSL support (recommended) read the manual or my
# HOWTO in /usr/share/doc/mysql-server/SSL-MINI-HOWTO.txt.gz
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the ndbd storage daemons,
# not from the ndb_mgmd management daemon.
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1
falko
12th August 2007, 14:58
Looks ok. Can you connect using
mysql -u root -p?
DazzyB
12th August 2007, 18:10
Well it askes for a password, but the mysql client is trying to connect via /tmp/mysql.sock
and the sock file is in /var/run/mysqld/mysql.sock
so I set that in webmin, and it works... in webmin that is, but thats all I need, its also fine on port 3306, so alls good.
root@carterweb:~# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
root@carterweb:~#
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.