We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

ERROR 2002: Can't connect to local MySQL server through socket

thechase22
thechase22 asked
on
Medium Priority
1,573 Views
Last Modified: 2008-01-09
Hi all im t rying to run this web application called vtigerCRM, I run the script that starts it all up, but I get this error:

Starting apache at port 81


MySQL home: /vtiger/vtigerCRM4_2/mysql


Checking  whether the MySQL server is already running

ERROR 2002: Can't connect to local MySQL server through socket '/vtiger//vtigerCRM4_2/mysql/mysql.socket' (2)

Mysql Server is not running. Going to start the  mysql server at port 3308

rm: cannot remove `/var/run/mysqld/mysqld.pid': Permission denied
./bin/mysqld_safe: line 281: /var/log/mysqld.log: Permission denied
ERROR 2002: Can't connect to local MySQL server through socket '/vtiger//vtigerCRM4_2/mysql/mysql.socket' (2)

****************************************************************************
Unable to start the mysql server. Check whether the port 3308 is free



Any ideas? seems a bit straight forward
Comment
Watch Question

Commented:
Vtiger CRM is a bundled package so you don't have as much control over the individual installation of components.
Is this error produced during installation?
Is the installation successful but it just can't connect to mysql?

To see if mysql is running:
shell> nmap -sT localhost

This will show you all ports and services that are currently running.

Author

Commented:
Hey and thanks ever so much for your reply.

Correct, installation was successful thank god, I had a nightmare with the apache, but that on its own had its own problem, took me 5 days to figure out, I had to disable SElinux in the text file.

Ill try what you said when I get to work though.

Author

Commented:
Still isnt working and im getting the same error, anything else we can try?

Author

Commented:
Ok sorry I didnt type the command in properly, I get this corrently:

(The 1665 ports scanned but not shown below are in state: closed)
PORT      STATE SERVICE
22/tcp    open  ssh
25/tcp    open  smtp
111/tcp   open  rpcbind
631/tcp   open  ipp
3306/tcp  open  mysql
8080/tcp  open  http-proxy
10000/tcp open  snet-sensor-mgmt
50000/tcp open  iiimsf
50002/tcp open  iiimsf

Thing is, the mysql, runs oin port 3308, so 3306 like you currently see, shouldnt matter?

Commented:
So in your original post it says, "Mysql Server is not running. Going to start the mysql server at port 3308"
Somewhere in the code its pointing to the wrong port.  IMHO, I'm not sure how to fix this so you may want to post this on the vTiger Forum page or circle an email.

Author

Commented:
Ok good, at least I have some direction, I think it is a mysql problem, because I have searched the error and alot of people have that error.

Could you possibly direct me to what file mysql uses to start etc, the config file perhaps so I could search around, the Vtiger forums are rubish, and I seem to always get my problems sorted on this site :)
Commented:
MySQL can be installed in any directory... from your post it appears to be in: /vtiger//vtigerCRM4_2/mysql/
And it used a binary distribution, probably a .tar file.  All the data, indices, and log files will be in that directory also.
The config file will end with .cnf (usually /etc/my.cnf).

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I did a search, and there isnt one in there, is there a chance I have to create one, perhaps use a sample.cnf or something? Maybe I could use the master mysql my.cnf and ammend it for vtiger, what do you reckon?
CERTIFIED EXPERT

Commented:
/etc/init.d/mysql.server is the file that is used to start or stop the server

chigs20 is correct.
vTiger is trying to look for mysql whether it is running on port 3308 or not. if not it is trying to start the server at 3308.
but actually your mysql is running under 3306 port.
so check the vTiger forums for point the mysql port to 3306 instead of 3308.
or else you can change the port of your mysql to 3308.

stop the mysql server if running using the followin command
/etc/init.d/mysql.server stop
open my.cnf available under /etc/my.cnf
and add this line just under [mysqld], i.e.,
[mysqld]
port = 3308

now start the mysql usign
/etc/init.d/mysql.server start

Author

Commented:
so let me get this straight, the file under /etc/my.cnf controls all instances of mysql? regardless of which type of application uses its own mysql, also if your running mysql on different ports, u need this file??

Im gonna try the things you just said, but I just wanted to ask that question.
CERTIFIED EXPERT

Commented:
yes you are right.
my.cnf is not a mandatory file, even if the file doesnt exist mysql works, but with default settings.
using my.cnf you can change the settings of mysql, fine tune mysql...etc..etc

Author

Commented:
Now im getting this error:

Starting apache at port 81

httpd not running, trying to start

MySQL home: /vtiger/vtigerCRM4_2/mysql


Checking  whether the MySQL server is already running

warning: World-writeable config file /etc/my.cnf is ignored
ERROR 2002: Can't connect to local MySQL server through socket '/vtiger//vtigerCRM4_2/mysql/mysql.socket' (2)

Mysql Server is not running. Going to start the  mysql server at port 3308

warning: World-writeable config file /etc/my.cnf is ignored
warning: World-writeable config file /etc/my.cnf is ignored
warning: World-writeable config file /etc/my.cnf is ignored

Checking if the vtigercrm4_2_4 database already exists

warning: World-writeable config file /etc/my.cnf is ignored


Thing is, the webpage now displays, although no one likes errors lol, so is this something I can fix easy?
CERTIFIED EXPERT

Commented:
paste the contents of your my.cnf here.
btw what is the version of your mysql
CERTIFIED EXPERT

Commented:
if possible try to paste the contents of the shell script also.
we will see what the shell script is trying to do.

Commented:
chmod a-w /etc/my.cnf

take away the world-writeable permissions and try again?

Author

Commented:
This is what I got, I couldnt do your command Sheeri, ohh wait let me try as SU...

[mysqld]
port = 3308
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
     
[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

CERTIFIED EXPERT

Commented:
>datadir=/var/lib/mysql
this should be
datadir=/var/lib/mysql/data

and
>basedir=/var/lib
should be
basedir=/var/lib/mysql

Author

Commented:
I have a question, since im using a separate mysql, for this application vtiger, is there any way I can check if its really using this file, because etc/my.cnf is the master mysql file.

Just curious...
CERTIFIED EXPERT

Commented:
what do you mean by using separate mysql?

Author

Commented:
did you not read my post?

Vtiger uses its own mysql.

But for some reason there is no my.cnf file in the vtiger/mysql directory
CERTIFIED EXPERT

Commented:
ok then.
change the my.cnf so that the vtiger picks this my.cnf
>warning: World-writeable config file /etc/my.cnf is ignored
since your my.cnf has doesnt point to vtiger/mysql it is ignoring it.

change you my.cnf to point to your vtiger/mysql

[mysqld]
port = 3308
datadir=/vtiger/vtigerCRM4_2/mysql/data
socket=/vtiger/vtigerCRM4_2/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
     
[mysql.server]
user=mysql
basedir=/vtiger/vtigerCRM4_2/mysql

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

>>rm: cannot remove `/var/run/mysqld/mysqld.pid': Permission denied
>>./bin/mysqld_safe: line 281: /var/log/mysqld.log: Permission denied
the above error could be because of your mysql server is using these files but vtiger/mysql is trying to remove them.
so first stop you own mysql server and allow only vtiger/mysql to run.

stop your mysql server if running using the followin command
/etc/init.d/mysql.server stop

if you want to run both mysql servers in the same machine with different ports, there are lot of things to do.
just like that it will not work. so dont allow your mysql to run as of now.

Author

Commented:
Ok let me try what you just said, but how hard is it to run 2 mysqls?

Because I want to run mysql for this vtiger, and mysql for just normal linux, for my testing etc, I dont know why vtiger can't just make its own my.cnf, it does the rest of the files, or cant it work like that?

Author

Commented:
Could you point me in the right direction in runnin 2 mysql's at the same time?
CERTIFIED EXPERT
Commented:

Author

Commented:
ok some of the links im still checking out, but heres one that will give your brain a hard time, im still getting this error

./bin/mysqld: File './vtslowquery.log' not found (Errcode: 13)

Warning: World-writable config file '/vtigercrm-5.0.2/vtigerCRM5/mysql/my.cnf' is ignored

Is it permissions still?
CERTIFIED EXPERT

Commented:
>>./bin/mysqld: File './vtslowquery.log' not found (Errcode: 13)
vtiger is trying to log slow queries, but it is unable to find the log file.
so you need to specify the slow query log in my.cnf.

log-slow-queries = ./vtslowquery.log

Author

Commented:
everything is workiong now, dont ask me why, but for some reason, the php.ini in the directory had wrong permissions, I 777 them, and I loswt all the errors, strange that.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.