Access denied for user 'root'@'localhost' (using password:YES)解决方法
在MySQL的使用过程中,我们可能会碰到“Access denied for user 'root'@'localhost' (using password:YES)”的问题,那么接下来我们就来解决它。
经过我的百度查询最后得出结论:出现这种错误有两种可能,一是MySQL的root用户的密码错误,二是权限不够的问题。通常解决办法是修改密码。。。
由于我使用的是Windows系统,所以方法也是Windows系统的修改方法:
1、开始 → 搜索栏里面输入cmd → 右键cmd.exe选择以管理员的身份运行(亦可以在C:\Windows\System32目录下找到这个cmd.exe,右键,以管理员身份运行)
2、输入net stop mysql停止MySQL服务
3、输入命令行来到mysql的bin目录下,输入下列粗体命令
D:\MySQL\bin>mysqld --defaults-file="D:\MySQL\my.ini" --console --skip-grant-tables
等一下,显示出以下结果说明MySQL启动:
22:26:09 [Warning] The syntax '--log' is deprecated and will be removed inMySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
22:26:09 [Warning] The syntax '--log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '--slow_query_log'/'-- slow_query_log_file' instead.
22:26:09 [Warning] The syntax '--log' is deprecated and will be removed in MySQL 7.0. Please use '--general_log'/'--general_log_file' instead.
22:26:09 [Warning] The syntax '--log_slow_queries' is deprecated and will be removed in MySQL 7.0. Please use '--slow_query_log'/'--slow_query_log_file' instead.
22:26:09 [ERROR] The update log is no longer supported by MySQL in version 5.0 and above. It is replaced by the binary log. Now starting MySQL with --log-bin='' instead.
22:26:09 InnoDB: Started; log sequence number 0 324221
22:26:09 [Note] mysqld: ready for connections.Version: '5.1.33-community-log' socket: '' port: 3306 MySQL Community Server (GPL)
4、再以管理员的身份打开一个cmd.exe,输入命令行来到mysql的bin目录下,输入:mysql -uroot mysql
5、进入mysql之后,输入命令行修改密码:
mysql>update user set authentication_string=password('123456') where user='root';
6、刷新权限:mysql>flush privileges;
7、退出mysql:mysql> quit;
8、关闭MySQL:D:\MySQL\bin>mysqladmin shutdown(出现错误,则:mysqladmin -uroot -p shutdown 然后输入新密码)
9、至此修改密码完成,可以输入命令行:net start mysql 启动MySQL服务,mysql -uroot -p ,输入密码就可以进入mysql了。
Access denied for user 'root'@'localhost' (using password:YES)解决方法的更多相关文章
- MySQL------报错Access denied for user 'root'@'localhost' (using password:NO)解决方法
报错:Access denied for user 'root'@'localhost' (using password:NO) 原因:没有给用户“root'@'localhost”赋予数据库权限 解 ...
- 转载--MYSQL5.7:Access denied for user 'root'@'localhost' (using password:YES)解决方法
1.打开MySQL目录下的my.ini文件,在文件的最后添加一行"skip-grant-tables",保存并关闭文件; 2.重启MySQL服务; 3.通过cmd行进入MySQL的 ...
- linux下mysql出现Access denied for user 'root'@'localhost' (using password: YES)解决方法
# /etc/init.d/mysql stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # my ...
- ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)解决办法
问题:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 很久没用这台电脑的mysql ...
- mac 安装mysql + 修改root用户密码 + 及报Access denied for user 'root'@'localhost' (using password:YES)解决办法
1.下载MySQL 到mysql的官网http://dev.mysql.com/downloads/mysql/然后在页面中会看到“MySQL Community Server”下方有一个“downl ...
- java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) 解决办法
一.背景 在Spark中,将DStream写入到MySQL出现错误:java.sql.SQLException: Access denied for user 'root'@'localhost' ( ...
- Access denied for user 'root'@'IP' (using password:YES)解决方法
在MySql的使用过程中,碰到“Access denied for user 'root'@'IP' (using password:YES)”的问题,使用以下语句修改后还是不行. GRANT ALL ...
- 连接mysql报错Access denied for user 'root'@'localhost' (using password: YES)解决办法
1.打开MySQL目录下的my.ini文件,在文件的最后添加一行“skip-grant-tables”(免密码登录),保存并关闭文件,重启MySQL服务. 2.通过命令行进入MySQL的BIN目录,输 ...
- MySQL出现 Access denied for user 'root'@'localhost' (using password:YES) 解决办法
1.先停止MySQL服务,然后在MySQL安装目录(我的是C:\Program Files (x86)\MySQL\MySQL Server 5.1)找到my.ini文件,在最后一行添加skip-gr ...
随机推荐
- Angular 4 路由守卫
路由守卫 只有当用户已经登录并拥有某些权限时才能进入某些路由 一个有多个表单组成的向导,如注册流程,用户只有在当前组件的组件中填写了满足要求的信息才可以导航到下一个路由 当用户未执行保存操作而试图离开 ...
- Windows OS系统变量
%userprofile% C:\Users\Administrator\ %windir% C:\Windows\
- redis通过dump.db文件 进行数据替换 复制
进行数据替换无非就是三步, 杀掉redis进程 ------------> 复制 dump.db文件 ------------------>启动redis pkill redis-se ...
- C/C++基础----表达式
1 基本概念 类型转换,小整型通常会被提升. 运算符重载,运算对象的个数.运算符的优先级和结合律都是无法改变的. 左值右值,对象被用做右值时,使用的是对象的值(内容):用做左值时,使用的是对象的身份( ...
- 术语-服务:PaaS
ylbtech-术语-服务:PaaS PaaS是Platform-as-a-Service的缩写,意思是平台即服务. 把服务器平台作为一种服务提供的商业模式.通过网络进行程序提供的服务称之为SaaS( ...
- Ubuntu终端快捷键使用
快捷键 功能 Tab 自动补全 Ctrl+a 光标移动到开始位置 Ctrl+e 光标移动到最末尾 Ctrl+k 删除此处至末尾的所有内容 Ctrl+u 删除此处至开始的所有内容 Ctrl+d 删除当前 ...
- mongodb 怎样检测 安装成功 以及mongodb的一些增删改查命令
mongodb 主页 http://www.mongodb.org/ 1.先在网上下载一个mongodb的安装包,再打开cmd命令,找到你装mongodb的文件的路径,进到mongodb的文件下的li ...
- Eclipse修改workspace目录的几种方式
Eclipse是一款很强的Java IDE,我们在开始的时候,往往设定了默认的workspace,当用久在之后,我们可能要去更改一下workspace的位置.下面有几种方法可以更改workspace的 ...
- 补充2:Golang 一些特性
Go语言的这些地方都做的还不错: 拥有自动垃圾回收: 不用手动释放内存 一个包系统: Go 语言的源码复用建立在包(package)基础之上.包通过 package, import, GOPATH 操 ...
- css基础示例代码
选择器 引入方式 <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...