LinuxQuestions.org
Visit Jeremy's Blog.
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 12-14-2010, 04:28 PM   #1
najmul002
LQ Newbie
 
Registered: Dec 2010
Posts: 1

Rep: Reputation: 0
Unhappy Access denied for user 'root'@'localhost'


I am new to ubuntu terminal. I have installed mysql-server, but i have no access. I have set the password during installation process. Please help me..

Used command:
mysql -u root -p

error message:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

OS: ubuntu 10.10
RAM: 1.5GB
processor:Intel pentiumD 3.00GHz
 
Old 12-14-2010, 06:29 PM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
In ubuntu, the root account is locked. When you installed, you created an initial user which is the admin user. You must use sudo and enter this initial user's password to execute privileged commands.
 
Old 12-14-2010, 07:12 PM   #3
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Yes, Andrewthomas is correct that Ubuntu locks the root account. However, Mysql can still have a root user.

SQL includes both the user and the host name in the authentication. This can cause problems if you try to access a remote (even over a LAN) SQL server. In your case, it looks like you just got the password wrong as you are attempting to access it from localhost.

I would recommend running dpkg-reconfigure mysql and replace the root password with one that you will remember. If you have any non root tables, you might want to back them up with a mysql-dump command first, just in case.
 
Old 12-14-2010, 07:23 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The error message is very generic. It could be the host is denied access, the user is denied access or wrong password.
For example, you might have "root@hostname" allowed access. Using "root@hostname.domainname" would be denied access.

The "root" user for mysql has no relation to the "root" user for Linux. By default, just after installation, the root account doesn't have a password. Simply press enter after "mysql -u root -p", you may have access. If that doesn't work, look in the manual (or Google) for options to start the mysqld server with, that will allow you access to reset password. This post may work as well http://www.linuxquestions.org/linux/...ssword_recovey


If you just installed mysql, make sure you read the MySQL manual. At least the section on security. By default, there is a demo table with global access. Delete it. The root account doesn't have a password. Be sure to create a password for it.

Last edited by jschiwal; 12-14-2010 at 07:27 PM.
 
  


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
MYSQL: Access denied for user 'root'@'localhost' (using password: NO) jun_tuko Linux - Software 3 03-05-2013 07:37 AM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) bobby953 Linux - Software 21 03-24-2011 09:35 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) shogun1234 Linux - Server 1 06-15-2009 12:12 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) S canegames Debian 11 07-18-2007 01:57 PM
Sarge mysql-server Access denied for user: root@localhost infinity432 Linux - Software 2 05-19-2005 12:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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