Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

'Access denied for user 'root'@'localhost'

Posted on 2009-07-10
17
Medium Priority
?
885 Views
Last Modified: 2013-11-15
root@Asterisk:~# mysqladmin -u root password password
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
0
Comment
Question by:1030071002
  • 9
  • 4
  • 3
  • +1
17 Comments
 
LVL 29

Assisted Solution

by:fosiul01
fosiul01 earned 240 total points
ID: 24824420
mysqladmin -u root password password

its if you want to set the password for the first time to mysql server

by looking error its looks your mysql server has already root password setup

if you want to change the password

mysqladmin -u root -p'oldpassword' password newpass
0
 

Author Comment

by:1030071002
ID: 24825133
how can you find out your mysqladmin password with out changing it
 
0
 
LVL 14

Assisted Solution

by:Fabio Marzocca
Fabio Marzocca earned 720 total points
ID: 24825174
try with your root password
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Assisted Solution

by:Fabio Marzocca
Fabio Marzocca earned 720 total points
ID: 24825196
I don't understand your mysqladmin syntax...

To access mysql, just type

mysql -u root -p

while, for mysqladmin, the syntax is:

 mysqladmin [options] command [command-options]

0
 

Author Comment

by:1030071002
ID: 24825291
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
0
 
LVL 14

Assisted Solution

by:Fabio Marzocca
Fabio Marzocca earned 720 total points
ID: 24825456
of course.. you need to type the right password.
0
 

Author Comment

by:1030071002
ID: 24826392
mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


0
 

Author Comment

by:1030071002
ID: 24826397
how can I reset the password with out knowing it
0
 
LVL 23

Assisted Solution

by:Maciej S
Maciej S earned 1040 total points
ID: 24826493
0
 

Author Comment

by:1030071002
ID: 24826661
asterisk-star@Asterisk:~$ /etc/init.d/mysql stop
 * Stopping MySQL database server mysqld                                        cat: /var/run/mysqld/mysqld.pid: Permission denied


0
 

Author Comment

by:1030071002
ID: 24826795
asterisk-star@Asterisk:~$ sudo /etc/init.d/mysql stop
 * Stopping MySQL database server mysqld                                 [ OK ]
asterisk-star@Asterisk:~$ mysqld_safe --skip-grant-tables &
[2] 858
asterisk-star@Asterisk:~$ nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[897]: started
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[907]: ended
mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[2]-  Done                    mysqld_safe --skip-grant-tables


0
 

Author Comment

by:1030071002
ID: 24826828
var/run/mysqld/
mysqld is empty what does that mean
0
 
LVL 23

Assisted Solution

by:Maciej S
Maciej S earned 1040 total points
ID: 24827114
You need run every command as root (with sudo in your case).
0
 

Author Comment

by:1030071002
ID: 24827247
i did that
0
 
LVL 23

Assisted Solution

by:Maciej S
Maciej S earned 1040 total points
ID: 24830307
I don't think so :)
asterisk-star@Asterisk:~$ sudo /etc/init.d/mysql stop
* Stopping MySQL database server mysqld                                 [ OK ]
asterisk-star@Asterisk:~$ mysqld_safe --skip-grant-tables &
[2] 858

I don't see 'sudo' in third line. Please run _all_ these commands (from the link above) again. This time, run them as root.
0
 

Author Comment

by:1030071002
ID: 24830721
root@Asterisk:/tmp# cd ..
root@Asterisk:/# sudo mysqld_safe --skip-grant-tables &
[1] 16661
root@Asterisk:/# nohup: ignoring input and redirecting stderr to stdout
mysqld_safe[16706]: A mysqld process already exists
root@Asterisk:/tmp# cd ..
root@Asterisk:/# sudo mysqld_safe --skip-grant-tables &
[1] 16661
root@Asterisk:/# nohup: ignoring input and redirecting stderr to stdout
mysqld_safe[16706]: A mysqld process already exists


0
 
LVL 23

Accepted Solution

by:
Maciej S earned 1040 total points
ID: 24830737
Don't run it twice. First run is enough. After running with --skip-grant-tables option, run rest of commands from above link.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question