• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 945
  • Last Modified:

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

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
1030071002
Asked:
1030071002
  • 9
  • 4
  • 3
  • +1
8 Solutions
 
fosiul01Commented:
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
 
1030071002Author Commented:
how can you find out your mysqladmin password with out changing it
 
0
 
Fabio MarzoccaFreelancerCommented:
try with your root password
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
Fabio MarzoccaFreelancerCommented:
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
 
1030071002Author Commented:
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
0
 
Fabio MarzoccaFreelancerCommented:
of course.. you need to type the right password.
0
 
1030071002Author Commented:
mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)


0
 
1030071002Author Commented:
how can I reset the password with out knowing it
0
 
1030071002Author Commented:
asterisk-star@Asterisk:~$ /etc/init.d/mysql stop
 * Stopping MySQL database server mysqld                                        cat: /var/run/mysqld/mysqld.pid: Permission denied


0
 
1030071002Author Commented:
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
 
1030071002Author Commented:
var/run/mysqld/
mysqld is empty what does that mean
0
 
Maciej SsysadminCommented:
You need run every command as root (with sudo in your case).
0
 
1030071002Author Commented:
i did that
0
 
Maciej SsysadminCommented:
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
 
1030071002Author Commented:
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
 
Maciej SsysadminCommented:
Don't run it twice. First run is enough. After running with --skip-grant-tables option, run rest of commands from above link.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 9
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now