| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-04-2007, 05:16 PM
|
#1
|
|
LQ Newbie
Registered: Aug 2006
Posts: 12
Rep:
|
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 -
|
|
|
|
02-04-2007, 08:44 PM
|
#2
|
|
Member
Registered: Feb 2006
Distribution: Ubuntu Hardy Heron
Posts: 130
Rep:
|
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.
|
|
|
|
07-26-2007, 02:47 AM
|
#3
|
|
LQ Newbie
Registered: Jul 2007
Posts: 1
Rep:
|
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 ?
|
|
|
|
06-30-2009, 12:06 PM
|
#4
|
|
Member
Registered: Jun 2008
Location: Evanston, Illinois
Distribution: RHEL 5.5
Posts: 98
Rep:
|
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
|
|
|
|
06-30-2009, 03:08 PM
|
#6
|
|
Member
Registered: Jun 2008
Location: Evanston, Illinois
Distribution: RHEL 5.5
Posts: 98
Rep:
|
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
|
|
|
|
07-01-2009, 12:25 AM
|
#7
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
@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
|
|
|
|
09-05-2010, 05:16 AM
|
#8
|
|
LQ Newbie
Registered: Dec 2009
Posts: 15
Rep:
|
This issue arrises because there is no sqladmin install. Please install the sqladmin by issuing the below command
yum install mysql-server
|
|
|
|
09-05-2010, 09:31 AM
|
#9
|
|
LQ Newbie
Registered: Aug 2009
Location: Kerala
Posts: 2
Rep:
|
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
|
|
|
|
09-10-2010, 01:54 PM
|
#10
|
|
LQ Newbie
Registered: Dec 2009
Posts: 15
Rep:
|
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
|
|
|
|
11-23-2012, 06:08 AM
|
#11
|
|
Senior Member
Registered: Dec 2008
Location: Gurgaon, India
Distribution: OpenSUSE 11.4
Posts: 4,581
|
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:29 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|