Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Server Platforms
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Server Platforms
Discussion regarding any server based ubuntu release.

 
Thread Tools Display Modes
Old December 4th, 2006   #1
DeepThoughts
5 Cups of Ubuntu
 
Join Date: Oct 2006
Location: The Northern Part of Swed
Beans: 19
Ubuntu 8.10 Intrepid Ibex
Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Apparently my MySQL-server is taking drugs.

In the conf-files I've found (/etc/mysql/debian.cnf & /etc/mysql/my.cnf) the port is defined as "/var/run/mysqld/mysqld.sock" and when I do 'ps aux | grep mysqld' I get this:
Code:
root     13970  0.0  0.2   3692  1460 pts/0    S    18:38   0:00 /bin/sh /usr/bin/mysqld_safe
mysql    14108  1.0  3.8 126896 19700 pts/0    Sl   18:38   0:05 /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     14109  0.0  0.1   2648   724 pts/0    S    18:38   0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
stefan   14424 14.0  0.1   2888   820 pts/0    S+   18:47   0:00 grep mysqld
And the "--socket=/var/run/mysqld/mysqld.sock" suggests that the conf-files are correct. But...

When I try to connect using 'mysql' I get this:
Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Why, oh why is it looking in the /tmp-folder??? What triggered this behavior and more importantly how do I fix this? It seriously irritating to have a test-server which can't be used for it's purpose.

This is all happening on an Dapper Drake install.
__________________
Stefan Nitsche
stefan_dot_nitsche_at_gmail_dot_com
DeepThoughts is offline   Reply With Quote
Old December 4th, 2006   #2
daniminas
A Carafe of Ubuntu
 
daniminas's Avatar
 
Join Date: May 2005
Location: Minas Uruguay
Beans: 140
Ubuntu 7.10 Gutsy Gibbon
Send a message via ICQ to daniminas Send a message via MSN to daniminas Send a message via Yahoo to daniminas Send a message via Skype™ to daniminas
Re: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

You can try to locate where mysqld.sock is:
> whereis mysqld.sock

and then edit /etc/mysql/my.cnf and write the new path.

daniminas is offline   Reply With Quote
Old December 4th, 2006   #3
DeepThoughts
5 Cups of Ubuntu
 
Join Date: Oct 2006
Location: The Northern Part of Swed
Beans: 19
Ubuntu 8.10 Intrepid Ibex
Re: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Quote:
Originally Posted by daniminas View Post
You can try to locate where mysqld.sock is:
> whereis mysqld.sock

and then edit /etc/mysql/my.cnf and write the new path.

If it was that easy...

There is a mysqld.sock at /var/run/mysqld/mysqld.sock which is the path configured in both debian.cnf and my.cnf but for some reason it looks in /tmp anyway.

To make things worse (at least I presume) when running 'whereis mysqld.sock' it only returns this:
Code:
mysqld: /usr/sbin/mysqld /usr/share/man/man8/mysqld.8.gz
How big should a *.sock file be? Nautilus reports it as 0 bytes...
__________________
Stefan Nitsche
stefan_dot_nitsche_at_gmail_dot_com
DeepThoughts is offline   Reply With Quote
Old December 4th, 2006   #4
craigmp
First Cup of Ubuntu
 
Join Date: Dec 2006
Location: Pennsylvania
My beans are hidden!
Ubuntu 6.06 Dapper
Re: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

I used to have problems running mysql on centos and the first 2 things I've always done were do run mysql_install_db and to change the owner and group on /var/db/mysql

chown -R mysql msyql
chgrp -R mysql mysql

just a thought...
craigmp is offline   Reply With Quote
Old December 4th, 2006   #5
DeepThoughts
5 Cups of Ubuntu
 
Join Date: Oct 2006
Location: The Northern Part of Swed
Beans: 19
Ubuntu 8.10 Intrepid Ibex
Re: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Quote:
Originally Posted by craigmp View Post
I used to have problems running mysql on centos and the first 2 things I've always done were do run mysql_install_db and to change the owner and group on /var/db/mysql

chown -R mysql msyql
chgrp -R mysql mysql

just a thought...
Unless something drastic changed I doubt that it is the problem. Because I've had everything up and running. This started (or stopped depending on how you see it) sometime during the last week. I'm inclined to believe an update of MySQL is to blame but I have no idea if that really is the case.
__________________
Stefan Nitsche
stefan_dot_nitsche_at_gmail_dot_com
DeepThoughts is offline   Reply With Quote
Old December 6th, 2006   #6
mcclimont
First Cup of Ubuntu
 
Join Date: Dec 2006
Beans: 1
Re: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

I'm also having this same problem.

The version of mysql client/server i have installed is 5.0.21-3ubuntu1.

I've found that although the server runs correctly, the clients do not.

With further exploration, i found that the settings used by the server (using the --print-defaults flag) are correct, but the mysql client does not have any of these defaults.

# mysqld --print-defaults
mysqld would have been started with the following arguments:
--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 --old_passwords=1 --bind-address=127.0.0.1 --key_buffer=16M --max_allowed_packet=16M --thread_stack=128K --query_cache_limit=1048576 --query_cache_size=16777216 --query_cache_type=1 --log-bin=/var/log/mysql/mysql-bin.log --expire-logs-days=20 --max_binlog_size=104857600 --skip-bdb --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 --old_passwords=1 --bind-address=127.0.0.1 --key_buffer=16M --max_allowed_packet=16M --thread_stack=128K --query_cache_limit=1048576 --query_cache_size=16777216 --query_cache_type=1 --log-bin=/var/log/mysql/mysql-bin.log --expire-logs-days=20 --max_binlog_size=104857600 --skip-bdb


# mysql --print-defaults
mysql would have been started with the following arguments:
(none)


So, i start the server again, getting the failed output on mysqlcheck which is run on startup.

# /etc/init.d/mysql start
Starting MySQL database server: mysqld.
# /usr/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) when trying to connect


As expected, the mysql client fails to start too.

# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)


Until i specify the socket to use!

# mysql --socket=/var/run/mysqld/mysqld.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.21-Debian_3ubuntu1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>


Now this should prove that mysqld is running fine, but that the defaults mysql and other clients need to connect to mysqld just are not there (as shown with --print-defaults)


My configuration file is still the default, and the client section does have the correct path to mysqld.sock file.


This raises the questions:
* Why are the defaults not there for the clients?
* Is this in error with this build of mysql client?
* How do i fix this?


Anyone have any thoughts?
mcclimont is offline   Reply With Quote
Old July 31st, 2007   #7
kdiebold
First Cup of Ubuntu
 
kdiebold's Avatar
 
Join Date: Jul 2007
My beans are hidden!
Re: Can't connect to local MySQL server through socket '/tmp/mysql.sock'

On Dapper (at least on my install), the problem is that the clients (mysql and mysqladmin) were looking for /etc/my.cnf instead of /etc/mysql/my.cnf. Seems like a compile-time bug in the package.

Easiest fix is:
sudo ln -s /etc/mysql/my.cnf /etc/my.cnf
kdiebold is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:47 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry