大致意思就是给mysql中的root用户添加密码 (密码我就用******表示)
[ooo@localhost ~]$ mysqladmin -u root -p ******
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
[ooo@localhost ~]$ sudo /etc/init.d/mysqld stop
停止 MySQL: [确定]
[ooo@localhost ~]$ sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 17641
[ooo@localhost ~]$ nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
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.0.67 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> UPDATE user SET Password=PASSWORD('******') where USER='root';
Query OK, 3 rows affected (0.02 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
[ooo@localhost ~]$ sudo /etc/init.d/mysqld restart
STOPPING server from pid file /var/run/mysqld/mysqld.pid
081205 12:11:33 mysqld ended
停止 MySQL: [确定]
启动 MySQL: [确定]
[1]+ Done sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[ooo@localhost ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.67 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> quit
Bye
[ooo@localhost ~]$
lxy811026 于 2011-08-11 10:30:48发表:
干得挺好
破冰 于 2011-08-03 11:40:36发表:
是给root设置密码吧
stevenst 于 2011-08-02 17:15:58发表:
1、这个是什么意思?是root没有密码,再给root添加密码?
2、还是root密码忘记了,然后通过另外的办法进行破解?
3、好像默认安装的mysql都是空密码吧,如果想更改密码的话,直接空密码登陆,然后去修改user表不就行了,为什么要这么一大堆的命令呢?看不懂
isofthome2011 于 2011-07-13 17:08:40发表:
感谢楼主 解决这个大难题
第一遍时 我没能成功
第二遍时 我认真琢磨 终于成功了 单其中有些代码不是很懂 还需努力啊
我打算好好整理下在共享给大家
再次谢谢楼主!
Hanwei 于 2008-12-05 12:57:22发表:
good