LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-25-2010, 06:46 AM   #1
narayanank
LQ Newbie
 
Registered: Jun 2007
Posts: 4

Rep: Reputation: 0
connection to mysql


when i try to connect to mysql from terminal i get the following error message.


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


What do i do to connect to mysql
 
Old 02-25-2010, 07:31 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
First off, is the MySQL daemon running; i.e., did it start at boot and if you execute
Code:
ps -ef | fgrep mysql
you should see something like
Code:
root      3683     1  0 Feb20 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/v
mysql     3720  3683  0 Feb20 ?        00:00:01 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=
If you do not have something similar to the above, did you initialize MySQL; i.e., did you, as root, execute
Code:
mysql_install_db --user=mysql
(the --user-mysql is vital) to initialize the data base. In the above case, the data directory is /var/lib/mysql and mysql_install_db creates a new installation with owner and group mysql (some things are group root). Your data directory will be owner and group mysql (if not, change them).

You may need to look for the daemon start up and shut down script (it could be in /etc/rc.d or somewhere similar) and make sure that it is executed during system start up.

Hope this helps some.
 
1 members found this post helpful.
Old 02-26-2010, 02:03 AM   #3
narayanank
LQ Newbie
 
Registered: Jun 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Talking

Quote:
Originally Posted by tronayne View Post
First off, is the MySQL daemon running; i.e., did it start at boot and if you execute
Code:
ps -ef | fgrep mysql
you should see something like
Code:
root      3683     1  0 Feb20 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/v
mysql     3720  3683  0 Feb20 ?        00:00:01 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=
If you do not have something similar to the above, did you initialize MySQL; i.e., did you, as root, execute
Code:
mysql_install_db --user=mysql
(the --user-mysql is vital) to initialize the data base. In the above case, the data directory is /var/lib/mysql and mysql_install_db creates a new installation with owner and group mysql (some things are group root). Your data directory will be owner and group mysql (if not, change them).

You may need to look for the daemon start up and shut down script (it could be in /etc/rc.d or somewhere similar) and make sure that it is executed during system start up.

Hope this helps some.

it was working thanks,. ihad actually not started the mysqld service
 
Old 02-27-2010, 01:20 PM   #4
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
just to say, you can use "ntsysv" to start up and stop all your services on fedora.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL connection Danielite Linux - Software 1 10-17-2008 07:53 AM
Mysql and mysql java connector, connection refused arubin Slackware 3 03-29-2008 01:41 AM
Mysql giving max connection errors, server has no connection limit. Jukas Linux - Server 1 03-26-2008 04:06 AM
Mysql Error: Lost Connection to Mysql during query ramnath Programming 5 11-18-2003 12:27 PM
mysql connection sathu Linux - Software 1 01-13-2003 01:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration