ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
来源:互联网 发布:获取json的key和value 编辑:程序博客网 时间:2024/06/05 05:32
centos 安装mysql出现这个错误,实在困扰人,这两天安装了两个系统的,都不知道什么时候怎么解决的,第二次又重新照解决方法
在这里写一下,方便以后用
下面是找的别人的解决方式,我是用yum安装的,可能会和大神们的有所不同,后面都有注释,最下面还有我操作的正确的步骤和显示的信息,这个解决方式应该算比较友好了。实在不行的童鞋,教你绝招,先卸载干净再装一次,卸载干净很重要的,具体的问搜索引擎去
# /etc/init.d/mysql stop ----------------1 安装位置不一样下面我停止mysql的方式也不一样,我用的是yum安装的,要用/etc/rc.d/init.d/mysqld stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & --照做 2
# mysql -u root mysql --3
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; --4
mysql> FLUSH PRIVILEGES; --5
mysql> quit --6
# /etc/init.d/mysql restart --7 停止mysql的方式不一样,开启当然也不一样 我用/etc/init.d/mysqld start
# mysql -uroot -p --8这个都熟悉了,其实已经完成,以下都是测试了
Enter password: <输入新设的密码newpassword>
mysql>
具体步骤和所显示的信息
1.[root@root 桌面]# /etc/rc.d/init.d/mysqld stop
停止 mysqld: [确定]
2.[root@root 桌面]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 3353
[root@root 桌面]# 121125 01:36:08 mysqld_safe Logging to '/var/log/mysqld.log'.
121125 01:36:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
3.mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.66 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
4.mysql> update user set Password=PASSWORD('root') where USER='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
5.mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
6.mysql> quit;
Bye
7.[root@root 桌面]# /etc/init.d/mysqld start
正在启动 mysqld: [确定]
8.[root@root 桌面]# mysql -u root -p
9.Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.66 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
在这里写一下,方便以后用
下面是找的别人的解决方式,我是用yum安装的,可能会和大神们的有所不同,后面都有注释,最下面还有我操作的正确的步骤和显示的信息,这个解决方式应该算比较友好了。实在不行的童鞋,教你绝招,先卸载干净再装一次,卸载干净很重要的,具体的问搜索引擎去
# /etc/init.d/mysql stop ----------------1 安装位置不一样下面我停止mysql的方式也不一样,我用的是yum安装的,要用/etc/rc.d/init.d/mysqld stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & --照做 2
# mysql -u root mysql --3
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; --4
mysql> FLUSH PRIVILEGES; --5
mysql> quit --6
# /etc/init.d/mysql restart --7 停止mysql的方式不一样,开启当然也不一样 我用/etc/init.d/mysqld start
# mysql -uroot -p --8这个都熟悉了,其实已经完成,以下都是测试了
Enter password: <输入新设的密码newpassword>
mysql>
具体步骤和所显示的信息
1.[root@root 桌面]# /etc/rc.d/init.d/mysqld stop
停止 mysqld: [确定]
2.[root@root 桌面]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 3353
[root@root 桌面]# 121125 01:36:08 mysqld_safe Logging to '/var/log/mysqld.log'.
121125 01:36:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
3.mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.66 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
4.mysql> update user set Password=PASSWORD('root') where USER='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
5.mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
6.mysql> quit;
Bye
7.[root@root 桌面]# /etc/init.d/mysqld start
正在启动 mysqld: [确定]
8.[root@root 桌面]# mysql -u root -p
9.Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.66 Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
到这开始欣喜吧………………
http://shaojiang216.blog.163.com/blog/static/1313258242012102515624945/
0 0
- error: 'Access denied for user 'root'@'localhost' (using password: YES)'
- #1045 - Access denied for user 'root'@'localhost' (using password: YES)
- 1045 access denied for user 'root'@'localhost' using password yes
- #1045 - Access denied for user 'root'@'localhost' (using password: YES)
- 1045 access denied for user 'root'@'localhost' using password yes
- 1045 - Access denied for user 'root'@'localhost'(using password:YES)
- 1045 access denied for user 'root'@'localhost' using password yes
- #1045 - Access denied for user 'root'@'localhost' (using password: YES)
- 1045 access denied for user 'root'@'localhost' using password yes
- 1045 access denied for user 'root'@'localhost' using password yes
- 1045-Access denied for user 'root'@'localhost'(using password:YES)
- Access denied for user 'root'@'localhost' (using password: YES) 1045
- 1045 access denied for user\'root\'@\'localhost\' using password yes
- 1045 access denied for user 'root'@'localhost' using password yes
- 1045 access denied for user ’root’@’localhost’ using password yes
- 1045, "Access denied for user 'root'@'localhost' (using password: YES)"
- 1045 access denied for user 'root'@'localhost' (using password yes)
- ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
- textbox选择历史记录后无法触发onchange事件
- 图表引擎AChartEngine 一
- Log4j解惑之一
- 字节流与位流的相互转换实现
- C++ 简单的日志类
- ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
- 小心得:处理两个头文件互调,死循环情况(将文件之间的编译依赖关系降至最低)
- 在线编程学习【优质的资源】
- C++ DLL远程注入与卸载函数
- 类成员函数继承(virtual、非virtual)
- 黑马程序员_WPF(WPF认识,Sender,C#基础加强类继承,集合,Xaml,控件通用属性)
- OpenOffice API 开发 (二) 样例程序编译
- DLL的远程注入及卸载技术详解
- C#遍历指定文件夹中的所有文件,DirectoryInfo和FileInfo的一些常用方法