LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-04-2009, 05:20 AM   #1
mythiliram
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Rep: Reputation: 0
Post how to connect to mysql after installing it.


after installing, i gave the command su mysql.
after that, its asking password.what password we have to enter for that?
After that i entered to bin path and entered ./mysql.Its not working.
My linux version is fc8 and mysql-5.0.37

Last edited by mythiliram; 08-04-2009 at 05:21 AM.
 
Old 08-04-2009, 05:26 AM   #2
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
On the konsole write

mysql -u <user> -p <password>

Password is the password you set for the user. With root login you can log in to mysql by typing mysql on your konsole.

If you have not set the password while installing mysql it will give you mysql prompt and in case u set the password while installing, Enter the password to get the mysql prompt
 
Old 08-04-2009, 06:02 AM   #3
mythiliram
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Original Poster
Rep: Reputation: 0
i didn't set any password while installing..but it is asking password to enter.
 
Old 08-04-2009, 06:17 AM   #4
mrrangerman
Member
 
Registered: Oct 2007
Location: MI
Distribution: Debian Slackware
Posts: 528

Rep: Reputation: 59
Then just press enter, by default the passwd is set to nothing. The passwd for mysql is independent of any accounts already on the system.
 
Old 08-04-2009, 06:18 AM   #5
mythiliram
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Original Poster
Rep: Reputation: 0
Question error 2002:

After giving command su mysql, it is asking password. i didnt set any password while installing.
After changing the path to bin, gave the command ./mysql.
The error is " ERROR 2002(HY000): cant connect to local Mysql server through socket '/var/lib/mysql/mysql.sock' (13)

How to overcome this?? Please rectify as soon as possible.
 
Old 08-04-2009, 06:20 AM   #6
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Is mysql service running?
 
Old 08-04-2009, 06:22 AM   #7
mythiliram
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Original Poster
Rep: Reputation: 0
yes it is running
 
Old 08-04-2009, 06:24 AM   #8
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Ok are you running it as root or user that is allowed it to do?
 
Old 08-04-2009, 06:39 AM   #9
mythiliram
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Original Poster
Rep: Reputation: 0
its running as user.
 
Old 08-04-2009, 06:50 AM   #10
mythiliram
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Original Poster
Rep: Reputation: 0
The same thing i had done, without entering anything. It replied su: incorrect password.
what is the next command to be entered to connect to mysql?
I changed the path to bin and gave the command ./mysql.
I got the error ":cant connect to mysql server through socket /var/lib/mysql/mysql.sock."

How to rectify this??
 
Old 08-04-2009, 07:00 AM   #11
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by mythiliram
The same thing i had done, without entering anything. It replied su: incorrect password.
Just for clearification. You don't have to become anyother user when connecting to mysql. MySQL uses a authentication method on its own. It's not any way related to the linux users or alike.

Quote:
Originally Posted by mythiliram
I changed the path to bin and gave the command ./mysql.
Normaly you don't have to change into the directory where the binary is you want to execute. They normaly reside inside the directories setup in th enviormental variable $PATH.
To verify this do a
Code:
whereis mysql
on the prompt.

Quote:
Originally Posted by mythiliram
I got the error ":cant connect to mysql server through socket /var/lib/mysql/mysql.sock."
This is where it's getting intresting. What the error message is trying to tell you is that there is no file(socket) at /var/lib/mysql/mysql.sock.
This can have variable cause. First check if the file is there
Code:
ls /var/lib/mysql
If not see if mysql itself is running
Code:
ps aux | grep mysql
which either resides in /etc or on debian like distributions /etc/mysql

If not start it with
Code:
/etc/init.d/mysql start
If mysql is allready running take a look at the config file of mysql. my.cnf
Somewhere in there it should tell you where the socket resides.

check out the man page of mysql to get an overview of possible options like
-u
-p
-h
-P
 
Old 08-04-2009, 07:27 AM   #12
mythiliram
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Original Poster
Rep: Reputation: 0
Thank u very much for ur each n every expalnation.
It is running but not connecting to mysql.what shall i do?
 
Old 08-04-2009, 07:38 AM   #13
mythiliram
LQ Newbie
 
Registered: Aug 2009
Posts: 16

Original Poster
Rep: Reputation: 0
uninstall mysql

how to uninstall mysql in linux.
what are the commands to uninstall??
 
Old 08-04-2009, 07:57 AM   #14
tanveer
Member
 
Registered: Feb 2004
Location: e@rth
Distribution: RHEL-3/4/5,Gloria,opensolaris
Posts: 525

Rep: Reputation: 37
please post the output of
# ps afxwww |grep mysql

Is MySQL installed thourgh RPM of FC8 or you compiled it?

If using RPM then no need to use 'su' as zhjim told. Just use the command
# mysql -u root
and it will do.
Are you logging as root or normal user when you try to run mysql command?
 
Old 08-04-2009, 08:04 AM   #15
mrrangerman
Member
 
Registered: Oct 2007
Location: MI
Distribution: Debian Slackware
Posts: 528

Rep: Reputation: 59
What distro are you using i.e. Debian, Ubuntu? And how did you install it, did you use the package manager or a pre compiled package or from source?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL serve vinnyband Linux - Software 3 10-30-2008 02:53 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 01:52 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:26 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration