LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-04-2007, 05:16 PM   #1
pete44904
LQ Newbie
 
Registered: Aug 2006
Posts: 12

Rep: Reputation: 5
Smile mysql error connect to server at 'localhost' failed


Hi i am currently trying to get mysql installed so that i can try out XOOPS on my Fedora 6 test box - but when i try to use the command
Quote:
mysqladmin -u mysql -p create xoops4
to create a new user it asks me for a password for mysql but i haven't given it one yet and when i enter a password i get the following error. I have tried to search google for a solution to it but i couldn't find one.

Code:
[root@xoops ~]# mysqladmin -u mysql -p create xoops4
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'mysql'@'localhost' (using password: YES)'
Any help on what i am doing wrong would be greatly appreciated -
 
Old 02-04-2007, 08:44 PM   #2
kdrlx
Member
 
Registered: Feb 2006
Distribution: Ubuntu Hardy Heron
Posts: 130

Rep: Reputation: 17
have you set the password for the mysql-root account ? if not first do that -
$> mysqladmin -u root password 'new-password'

check if you can connect with the root account -
$> mysql -u root -p
It will prompt for password. Enter the one you just created.

.. then add users and then create databases etc.
 
Old 07-26-2007, 02:47 AM   #3
dhana_space1
LQ Newbie
 
Registered: Jul 2007
Posts: 1

Rep: Reputation: 0
same problem...

[~]# mysqladmin -u root -p status
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!

any solution or any help ?
 
Old 06-30-2009, 12:06 PM   #4
Sanford Stein
Member
 
Registered: Jun 2008
Location: Evanston, Illinois
Distribution: RHEL 6.4
Posts: 126

Rep: Reputation: 17
Was a solution to this ever found?

I installed MySql, and I get the failure to connect to localhost running mysql or mysqladmin no matter what user I try. It is not possible to set a password for a user because of the failure to connect.

Thanks,
Sanford Stein
 
Old 06-30-2009, 01:21 PM   #5
elfoozo
Member
 
Registered: Feb 2004
Location: Washington, USA
Distribution: Debian
Posts: 265

Rep: Reputation: 32
Have you seen this thread? Few good suggestions to try.

http://forums.mysql.com/read.php?35,64808,64808
 
Old 06-30-2009, 03:08 PM   #6
Sanford Stein
Member
 
Registered: Jun 2008
Location: Evanston, Illinois
Distribution: RHEL 6.4
Posts: 126

Rep: Reputation: 17
Actually I found the solution at:

http://www.redhat.com/magazine/007may05/features/mysql/

The command that worked was:

# mysql -u root -p -h localhost

and then I entered my root password at the prompt and got mysql>

Why this worked, and nothing else did, I can't say
 
Old 07-01-2009, 12:25 AM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
@Sanford Stein

The mysql client makes certain assumptions when you don't pass information on the command line. In this case it might have passed the wrong host to the server.

PS You did not post the exact error that you got, but I think it was a different one from the one in the opening post.

Last edited by Wim Sturkenboom; 07-01-2009 at 07:43 AM. Reason: I think I was on the wrong track with my original post
 
Old 09-05-2010, 05:16 AM   #8
fear_matrix
LQ Newbie
 
Registered: Dec 2009
Posts: 15

Rep: Reputation: 0
This issue arrises because there is no sqladmin install. Please install the sqladmin by issuing the below command

yum install mysql-server
 
Old 09-05-2010, 09:31 AM   #9
sukujgrg
LQ Newbie
 
Registered: Aug 2009
Location: Kerala
Posts: 2

Rep: Reputation: 0
The correct syntax for passing password with "mysql" command is as follows.

[suku@techtrunch]mysql -u root -pyourpassword -h localhost ###see no space after "-p".

If you have forgotten the password, since you have root account, reset it. There are lot of sites describing about resetting mysql user passwords. Simply follow those.

----
Suku
techtrunch.com
 
Old 09-10-2010, 01:54 PM   #10
fear_matrix
LQ Newbie
 
Registered: Dec 2009
Posts: 15

Rep: Reputation: 0
Just wanted to make one more point here, sometimes you will get the below error when you restart your linux server

Code:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
So in order to solve this problem you need to restart your mysqld by using the below command

Code:
service mysqld restart
 
Old 11-23-2012, 06:08 AM   #11
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Following steps solved this error for me.

openSUSE 11.4
Server version: 5.1.53
Code:
sudo /usr/bin/mysql_install_db
sudo /etc/init.d/mysql start
sudo mysqladmin -u root password 'new'
mysql -h localhost -u root -pnew
 
  


Reply

Tags
mysql



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
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
Mysql Server error Can't connect to local MySQL server through socket sridhar11 Debian 10 07-26-2011 12:55 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
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.so amee_stars Linux - Newbie 2 01-22-2007 02:48 AM
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 - Server

All times are GMT -5. The time now is 02:45 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