再连接数据库就出现了这种问题了:
Access denied for user 'root'@'localhost' (using password: YES)
我的系统是redhat的
我找这个帖子http://blog.chinaunix.net/u1/35320/showart_305024.html上操作
以及重装mysql都没用解决问题
28 个解决方案
#1
权限问题?
#2
是的,确实是权限问题,我用mysqld_safe --user=mysql --skip-grant-tables --skip-networking &就能进mysql
这种问题怎么解决呢
这种问题怎么解决呢
#3
root'@'localhost
你要链接root用户的话就要得有相应的root权限吧~或者更改用户
你要链接root用户的话就要得有相应的root权限吧~或者更改用户
#4
现在进入不了mysql怎么改权限啊
#5
不用进root,进其他用户~
#6
进其他用户,怎么进,数据库暂时没有其它用户
#7
汗。。要不再重装下巴
#8
重装3次了不行啊,还是一样的,网上有别人遇到同样问题说重装了也不行
#9
login as: root
root@121.101.223.215's password:
Access denied
root@121.101.223.215's password:
Last login: Thu Sep 2 14:28:57 2010 from 123.119.92.144
[root@localhost ~]# clear
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL.... [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 23998
[root@localhost ~]# 100902 14:40:20 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 14:40:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> grant all privileges on *.* to root@'%' identified by '111111';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> etc/init.d/mysql restart
-> quit
->
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'etc/init.d/mysql restart
quit' at line 1
mysql> quit
Bye
[root@localhost ~]# /etc/init.d/mysql restart
Shutting down MySQL.100902 14:41:50 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
[È·¶¨]
Starting MySQL. [È·¶¨]
[1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]#
root@121.101.223.215's password:
Access denied
root@121.101.223.215's password:
Last login: Thu Sep 2 14:28:57 2010 from 123.119.92.144
[root@localhost ~]# clear
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL.... [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 23998
[root@localhost ~]# 100902 14:40:20 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 14:40:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> grant all privileges on *.* to root@'%' identified by '111111';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> etc/init.d/mysql restart
-> quit
->
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'etc/init.d/mysql restart
quit' at line 1
mysql> quit
Bye
[root@localhost ~]# /etc/init.d/mysql restart
Shutting down MySQL.100902 14:41:50 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
[È·¶¨]
Starting MySQL. [È·¶¨]
[1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]#
#10
我操作过程就是上面的,我是菜鸟,不知道怎么办,重装也不行,用tar.gz重装了,用rpm重装了都不行,
在线狂等
在线狂等
#11
你根本就没有设置root使用mysql的密码把!
#12
原来是有密码的,现在后来用mysqladmin改成无密码了,就进不去了
#13
你怎么改的?
#14
加权限重设置?
#15
mysqladmin -uroot -p password
#16
用mysqld_safe --user=mysql --skip-grant-tables --skip-networking启动mysql 然后进去给root把密码加上
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
然后在重启mysql 用新设的密码访问
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
然后在重启mysql 用新设的密码访问
#17
改了之后用root和空密码是能登陆的,只是用show databases不能看到数据库mysql了,所以没有进一步修改权限了,重装后现在用root进都进不去了
#18
用mysqld_safe --user=mysql --skip-grant-tables --skip-networking启动mysql 然后进去给root把密码加上
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
这个方法用了,还是不行,你看一下我在第9楼发的东西,就有这个操作过程
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
这个方法用了,还是不行,你看一下我在第9楼发的东西,就有这个操作过程
#19
你9楼哪儿有这个操作?!!!
#20
mysql> show database;
mysql> grant all privileges on *.* to root@'%' identified by '111111';
我让你执行的
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
一样吗!》?
mysql> grant all privileges on *.* to root@'%' identified by '111111';
我让你执行的
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
一样吗!》?
#21
这个操作我做了好多遍了,不行,因为网上好多帖子都说这样,我就照做了,不行
#22
root的密码我已经用上面的方法给改了,不行,我再重做一次您看看
#23
login as: root
root@121.101.223.215's password:
Last login: Thu Sep 2 14:39:16 2010 from 123.119.92.144
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL. [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 24286
[root@localhost ~]# 100902 15:03:07 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 15:03:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> UPDATE user SET Password='********' where USER='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]#
[root@localhost ~]#
root@121.101.223.215's password:
Last login: Thu Sep 2 14:39:16 2010 from 123.119.92.144
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL. [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 24286
[root@localhost ~]# 100902 15:03:07 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 15:03:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> UPDATE user SET Password='********' where USER='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]#
[root@localhost ~]#
#24
mysqld_safe --user=mysql --skip-grant-tables --skip-networking启动mysql
这种方式下不能执行grant语句。
这种方式下不能执行grant语句。
#25
这是你执行的
mysql> UPDATE user SET Password='********' where USER='root';
这是我说的
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
拜托你仔细看看行吗?
mysql> UPDATE user SET Password='********' where USER='root';
这是我说的
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
拜托你仔细看看行吗?
#26
我没有执行啊,您看第23楼的,
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL... [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 24482
[root@localhost ~]# 100902 15:09:24 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 15:09:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user,host,password from user;
+------+-----------------------+-----------+
| user | host | password |
+------+-----------------------+-----------+
| root | localhost | ******** |
| root | localhost.localdomain | ******** |
| root | 127.0.0.1 | ******** |
+------+-----------------------+-----------+
3 rows in set (0.00 sec)
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL... [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 24482
[root@localhost ~]# 100902 15:09:24 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 15:09:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user,host,password from user;
+------+-----------------------+-----------+
| user | host | password |
+------+-----------------------+-----------+
| root | localhost | ******** |
| root | localhost.localdomain | ******** |
| root | 127.0.0.1 | ******** |
+------+-----------------------+-----------+
3 rows in set (0.00 sec)
#27
多谢,成功了
#28
不错,很好
#1
权限问题?
#2
是的,确实是权限问题,我用mysqld_safe --user=mysql --skip-grant-tables --skip-networking &就能进mysql
这种问题怎么解决呢
这种问题怎么解决呢
#3
root'@'localhost
你要链接root用户的话就要得有相应的root权限吧~或者更改用户
你要链接root用户的话就要得有相应的root权限吧~或者更改用户
#4
现在进入不了mysql怎么改权限啊
#5
不用进root,进其他用户~
#6
进其他用户,怎么进,数据库暂时没有其它用户
#7
汗。。要不再重装下巴
#8
重装3次了不行啊,还是一样的,网上有别人遇到同样问题说重装了也不行
#9
login as: root
root@121.101.223.215's password:
Access denied
root@121.101.223.215's password:
Last login: Thu Sep 2 14:28:57 2010 from 123.119.92.144
[root@localhost ~]# clear
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL.... [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 23998
[root@localhost ~]# 100902 14:40:20 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 14:40:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> grant all privileges on *.* to root@'%' identified by '111111';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> etc/init.d/mysql restart
-> quit
->
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'etc/init.d/mysql restart
quit' at line 1
mysql> quit
Bye
[root@localhost ~]# /etc/init.d/mysql restart
Shutting down MySQL.100902 14:41:50 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
[È·¶¨]
Starting MySQL. [È·¶¨]
[1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]#
root@121.101.223.215's password:
Access denied
root@121.101.223.215's password:
Last login: Thu Sep 2 14:28:57 2010 from 123.119.92.144
[root@localhost ~]# clear
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL.... [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 23998
[root@localhost ~]# 100902 14:40:20 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 14:40:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> grant all privileges on *.* to root@'%' identified by '111111';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> etc/init.d/mysql restart
-> quit
->
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'etc/init.d/mysql restart
quit' at line 1
mysql> quit
Bye
[root@localhost ~]# /etc/init.d/mysql restart
Shutting down MySQL.100902 14:41:50 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
[È·¶¨]
Starting MySQL. [È·¶¨]
[1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]#
#10
我操作过程就是上面的,我是菜鸟,不知道怎么办,重装也不行,用tar.gz重装了,用rpm重装了都不行,
在线狂等
在线狂等
#11
你根本就没有设置root使用mysql的密码把!
#12
原来是有密码的,现在后来用mysqladmin改成无密码了,就进不去了
#13
你怎么改的?
#14
加权限重设置?
#15
mysqladmin -uroot -p password
#16
用mysqld_safe --user=mysql --skip-grant-tables --skip-networking启动mysql 然后进去给root把密码加上
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
然后在重启mysql 用新设的密码访问
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
然后在重启mysql 用新设的密码访问
#17
改了之后用root和空密码是能登陆的,只是用show databases不能看到数据库mysql了,所以没有进一步修改权限了,重装后现在用root进都进不去了
#18
用mysqld_safe --user=mysql --skip-grant-tables --skip-networking启动mysql 然后进去给root把密码加上
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
这个方法用了,还是不行,你看一下我在第9楼发的东西,就有这个操作过程
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
这个方法用了,还是不行,你看一下我在第9楼发的东西,就有这个操作过程
#19
你9楼哪儿有这个操作?!!!
#20
mysql> show database;
mysql> grant all privileges on *.* to root@'%' identified by '111111';
我让你执行的
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
一样吗!》?
mysql> grant all privileges on *.* to root@'%' identified by '111111';
我让你执行的
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
mysql> flush privileges;
mysql> quit
一样吗!》?
#21
这个操作我做了好多遍了,不行,因为网上好多帖子都说这样,我就照做了,不行
#22
root的密码我已经用上面的方法给改了,不行,我再重做一次您看看
#23
login as: root
root@121.101.223.215's password:
Last login: Thu Sep 2 14:39:16 2010 from 123.119.92.144
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL. [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 24286
[root@localhost ~]# 100902 15:03:07 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 15:03:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> UPDATE user SET Password='********' where USER='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]#
[root@localhost ~]#
root@121.101.223.215's password:
Last login: Thu Sep 2 14:39:16 2010 from 123.119.92.144
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL. [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 24286
[root@localhost ~]# 100902 15:03:07 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 15:03:07 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> UPDATE user SET Password='********' where USER='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost ~]#
[root@localhost ~]#
#24
mysqld_safe --user=mysql --skip-grant-tables --skip-networking启动mysql
这种方式下不能执行grant语句。
这种方式下不能执行grant语句。
#25
这是你执行的
mysql> UPDATE user SET Password='********' where USER='root';
这是我说的
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
拜托你仔细看看行吗?
mysql> UPDATE user SET Password='********' where USER='root';
这是我说的
mysql> update mysql.user set password=PASSWORD('这里改成你的密码') where User='root';
拜托你仔细看看行吗?
#26
我没有执行啊,您看第23楼的,
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL... [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 24482
[root@localhost ~]# 100902 15:09:24 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 15:09:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user,host,password from user;
+------+-----------------------+-----------+
| user | host | password |
+------+-----------------------+-----------+
| root | localhost | ******** |
| root | localhost.localdomain | ******** |
| root | 127.0.0.1 | ******** |
+------+-----------------------+-----------+
3 rows in set (0.00 sec)
[root@localhost ~]# /etc/init.d/mysql stop
Shutting down MySQL... [È·¶¨]
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 24482
[root@localhost ~]# 100902 15:09:24 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
100902 15:09:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@localhost ~]# 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.50 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select user,host,password from user;
+------+-----------------------+-----------+
| user | host | password |
+------+-----------------------+-----------+
| root | localhost | ******** |
| root | localhost.localdomain | ******** |
| root | 127.0.0.1 | ******** |
+------+-----------------------+-----------+
3 rows in set (0.00 sec)
#27
多谢,成功了
#28
不错,很好