mysql数据登陆出现如下错误: #mysql -uroot error: 'Access denied for user 'root'@'localhost' (using password: NO)'
解决方法: 问题原因:还未找到(待补充)。 一、sudo vim /etc/mysql/debian.cnf 记录文件中user和密码。 [client] host = localhost user = debian-sys-maint password = 0NynruOCi9W3kdnQ socket = /var/run/mysqld/mysqld.sock [mysql_upgrade] host = localhost user = debian-sys-maint password = 0NynruOCi9W3kdnQ socket = /var/run/mysqld/mysqld.sock
用debian-sys-maint用户登陆进数据库: #mysql -u debian-sys-maint -p0NynruOCi9W3kdnQ
二、重置root密码为123456: mysql>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456'); mysql>flush privileges mysql>quit
三、使用root新密码登陆 mysql -uroot -p123456