'Access denied for user 'root'@'lo

2020-01-27 01:12发布

I'm trying to set the password of the user root but I'm gettin the error below, any idea?

+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                                                              |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*436576511F70A4E3B305E1AB8E209851945D8687' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)


mysql> exit
Bye
root@tirengarfio:/var/www/rs2# mysqladmin -u root password foo,
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

标签: mysql
8条回答
Evening l夕情丶
2楼-- · 2020-01-27 01:55

when trying to run this command i got the same error

sudo mysqladmin create asteriskcdrdba

i simply add a few lines to the code

-u root -p

and pressed the enter key. i then typed my password and hit enter. Linux liked my command as nothing more was displayed

so maybe try

sudo <your command here> -u <username> -p

after that hit enter and enter your password

查看更多
不美不萌又怎样
3楼-- · 2020-01-27 01:56

Firstly, go to the folder support-files on terminal, and start the server by mysql.server start, Secondly, go to the folder bin on terminal or type /usr/local/mysql/bin/mysqladmin -u root -p password

It would ask you for the old temporary password which was given to you while installing Mysql, type that and type in your new password and it would work.

查看更多
登录 后发表回答