LinuxQuestions.org
Latest LQ Deal: Linux Power User 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 08-10-2009, 11:17 PM   #1
sumitrai
LQ Newbie
 
Registered: Aug 2009
Posts: 9

Rep: Reputation: 0
access denied


hii guys.....
i m facing this problem whenever i m trying to login into mysql to create new database.

[root@localhost etc]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
 
Old 08-11-2009, 12:23 AM   #2
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
I suggest you create a new user for mysql and use it instead of root. Not a good idea to use this account.
 
Old 08-11-2009, 12:34 AM   #3
vishesh
Member
 
Registered: Feb 2008
Distribution: Fedora,RHEL,Ubuntu
Posts: 661

Rep: Reputation: 66
Try
#mysql -u root -p -h localhost
(in password, specify password for your root login)

Thanks
 
Old 08-11-2009, 02:28 AM   #4
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,143
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Smile

From command prompt:

#mysql -u root(if u can login without password)

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('yourpassword')





Another way to set up a password for the root account is to use mysqladmin. From there use the following commands:
shell> mysqladmin -u root password "yourpassword"
shell> mysqladmin -u root -h host_name password "yourpassord"




The third method you may use to set up the passwords is to use UPDATE statement to alter users table directly from the database.

shell> mysql -u root
mysql> UPDATE mysql.user SET Password = PASSWORD('yourpassword')
-> WHERE User = 'root';
mysql> FLUSH PRIVILEGES;


Regards,

Prayag
 
Old 08-12-2009, 02:19 AM   #5
sumitrai
LQ Newbie
 
Registered: Aug 2009
Posts: 9

Original Poster
Rep: Reputation: 0
thnkss 4 ur reply guys....
but m nt even able 2 login by writing mysql -u root

it gives d same error....
 
Old 08-12-2009, 03:57 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
Make an account for mysql. Do not use root account for it. Not a safe idea. Create mysql account
 
Old 08-12-2009, 12:18 PM   #7
xmagicxxx
LQ Newbie
 
Registered: Mar 2007
Posts: 13

Rep: Reputation: 0
Lightbulb

Quote:
Originally Posted by sumitrai View Post
thnkss 4 ur reply guys....
but m nt even able 2 login by writing mysql -u root

it gives d same error....
run mysql -uroot -ppassword

will definitly work. just put password for root user you have specified for mysql, default password is password. so if you havent set any password for root use in mysql, then just copy and paste the command.

-Smahajan
 
  


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
Not able to access network printer access denied. arvind.s Linux - Networking 1 08-04-2009 06:05 PM
squid "access.log" access denied no user name jatender Linux - Server 1 10-02-2007 04:28 AM
Access denied when attempting access samba share warlockvix Linux - Software 1 05-11-2007 02:36 PM
Suse 10.1, Access denied while trying to access a partition Rollotamasi Linux - Newbie 1 06-23-2006 04:59 PM
getting access denied , when trying to access camera as normal user bennythepitbull Linux - Hardware 2 11-04-2003 02:30 AM


All times are GMT -5. The time now is 11:49 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration