LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 10-30-2012, 08:29 AM   #1
swrobles
LQ Newbie
 
Registered: Oct 2012
Posts: 2

Rep: Reputation: Disabled
MySql unknown password


Hi,

I have installed MySql on a linux box. I try running the following and get this error.I have entered the root password and nothing.

[root@maauto ~]# /usr/bin/mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):


ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
Enter current password for root (enter for none):

I try to change the password and get the below.


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

Linux maauto.lin.com 2.6.32-71.el6.i686 #1 SMP Fri Nov 12 04:17:17 GMT 2010 i686 i686 i386 GNU/Linux



Any help would be appreciated.
 
Old 10-30-2012, 08:38 AM   #2
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
If you want to recover mysql password,

Stop mysql service

#/etc/init.d/mysql stop


These will skip password prompt

#mysqld_safe --skip-grant-tables &

Then you can login mysql without mysql password & after login you can change mysql password

#mysql -uroot

mysql> use mysql;
mysql> update user set password=PASSWORD("password") where User='root';
mysql> flush privileges;
mysql> quit

#service mysqld restart

Login mysql with rechanged password

#mysql -uroot -p

Last edited by jsaravana87; 10-30-2012 at 08:57 AM.
 
Old 10-30-2012, 09:48 AM   #3
swrobles
LQ Newbie
 
Registered: Oct 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you

This was great. For some reason I have to use mysqld not mysql but all the steps worked.
 
1 members found this post helpful.
  


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
Unknown login username and password Gaby Wilkens Linux - Newbie 22 04-24-2010 03:13 PM
Mysql not starting after changing mysql admin password in fedora prastal Linux - Newbie 1 02-20-2010 07:26 PM
Unknown root password SUSE v 10.2 robertw Linux - Security 1 09-23-2007 01:22 PM
Password Unknown cowpokeHenry Linux - Newbie 1 08-10-2005 08:10 PM
unknown root password michael brooks Linux - Security 6 07-05-2001 05:30 AM


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