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 09-02-2011, 05:07 AM   #1
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


Hi


i had placed % in my mysql configuration scripts but since its not listening localhost
i checked out my vi /etc/my.cnf localhost is enabled

root@localhost Desktop]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> \q
Bye
[root@localhost Desktop]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


vi /etc/my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

useradd chatRoot3

mysql1=$(</dev/urandom tr -dc A-Za-z0-9 | head -c6) ; echo $mysql1 ; echo $mysql1 | passwd --stdin chatRoot3

echo 'CREATE DATABASE chat3;' | mysql -uroot -psanjay
echo "CREATE USER 'chatRoot3'@'%' IDENTIFIED BY '$mysql1';" | mysql -uroot -pecare2@

echo "GRANT ALL PRIVILEGES ON *.* TO 'chatRoot3'@'%' IDENTIFIED BY '$mysql1';" | mysql -uroot -psanjay

echo -e "DATABASENAME\ndatabasename=chat3\ndatabaseusername=chatRoot3\npassword=$mysql1\ncustomername=$1 " | mail -s 'MysqlDatabase Access' xxxx@gmail.com

regards
arun
 
Old 09-02-2011, 07:43 AM   #2
timur91
Member
 
Registered: Aug 2011
Posts: 42

Rep: Reputation: Disabled
are you sure you set the root password for mysql? I can see you can login without a pass

try this:
Code:
select * from mysql.user where user='root';
See if there's a password for the root user with the % hostname, if not, set it

java socket

Last edited by timur91; 01-05-2012 at 05:35 AM.
 
Old 09-02-2011, 10:22 AM   #3
raevin
Member
 
Registered: Jul 2004
Distribution: Arch Linux, Ubuntu
Posts: 80

Rep: Reputation: 16
Quote:
Originally Posted by timur91 View Post
are you sure you set the root password for mysql? I can see you can login without a pass

try this:
Code:
select * from mysql.user where user='root';
See if there's a password for the root user with the % hostname, if not, set it
More importantly is to make sure a password is set. To do that, as it seems there is no password set for root, you can do it by running this command inside the MySQL prompt:
Code:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root_password_goes_here';
 
  


Reply



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 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) samnjugu Linux - Software 12 01-22-2013 06:22 AM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) bobby953 Linux - Software 21 03-24-2011 08:35 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) shogun1234 Linux - Server 1 06-15-2009 11:12 AM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) ShaqDiesel Linux - Server 1 09-11-2008 11:49 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) S canegames Debian 11 07-18-2007 12:57 PM

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

All times are GMT -5. The time now is 03: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
Open Source Consulting | Domain Registration