博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)解决方案
阅读量:4220 次
发布时间:2019-05-26

本文共 812 字,大约阅读时间需要 2 分钟。

 

新装mysql连接时会报错:ERROR 1045 (28000): Access denied for user ’root’@’localhost’ (using password: NO) 

解决方案如下:

 

方法一: 

# /etc/init.d/mysql stop 
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 
# mysql -u root mysql 
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 
# /etc/init.d/mysql restart 
# mysql -uroot -p 
Enter password: <输入新设的密码newpassword> 

 

mysql> 

 

 

方法二: 

直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码: 
# mysql -udebian-sys-maint -p 
Enter password: <输入[client]节的密码> 
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’; 
mysql> FLUSH PRIVILEGES; 
mysql> quit 
# mysql -uroot -p 
Enter password: <输入新设的密码newpassword> 

 

mysql> 

 

 

方法三: 

# mysql -uroot -p 
Enter password: <输入/etc/mysql/debian.cnf文件中[client]节提供的密码> 
至此,困惑多时的问题解决了!

转载地址:http://vqemi.baihongyu.com/

你可能感兴趣的文章
Linux系统之备份数据
查看>>
Linux系统之XFCE4.10 安装
查看>>
Linux系统之GCC常用命令
查看>>
Linux系统之GDB调试
查看>>
CUDA开发环境配置大全
查看>>
Linux14.04(64bit) + CUDA6.5 环境搭建
查看>>
Linux系统之复制粘贴命令
查看>>
Device Memory Spaces
查看>>
位运算之美--用 +、- 和位运算实现正整数除法和取模(2)
查看>>
位运算之美--用 + 、- 和位运算实现正整数除法和取模(1)
查看>>
位运算之 -- 按位与(&)操作 -- 快速取模算法
查看>>
按位与(&)、或(|)、异或(^)等操作符
查看>>
使用U盘模拟软盘
查看>>
从图割到图像分割 - 最大流算法
查看>>
从图割到图像分割 - 图的构造
查看>>
从图割到图像分割 - 多层图图割
查看>>
智能指针总结
查看>>
数学中国体力值
查看>>
数学建模十大常用算法
查看>>
C++文件操作详解
查看>>