我把mysql的用户名和密码给忘了

由 wake_up 在 04-11-2004 19:13 发表:

我把mysql的用户名和密码给忘了

[root@wake bin]# ./mysql -uroot -p

Enter password:

ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)

[root@wake bin]#

怎么办呀?


[email protected]


由 chg 在 04-20-2004 02:23 发表:


最笨的方法。

用另一台机装个mysql

把/usr/lib/mysql下的东西copy的有问题的机器的相应目录中。。。


由 chg 在 04-20-2004 02:25 发表:


or

在同一台的另外一个地方装mysql

装完后,在安装目录的data目录中把东西copy到有问题的mysql中。


由 luodonghua 在 04-20-2004 04:47 发表:


Log onto your system as either the Unix root user or as the same user that the mysqld server runs as.

Locate the .pid' file that contains the server's process ID. The exact location and name of this file depends on your distribution, hostname, and configuration. Common locations are: /var/lib/mysql/', /var/run/mysqld/' and /usr/local/mysql/data/'. Generally, the filename has the extension of .pid' and begins with either mysqld' or your system's hostname. Now you can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the name of the `.pid' file in the following command:

shell> kill cat /mysql-data-directory/hostname.pid

Note the use of backquotes rather than forward quotes with the cat command; these cause the output of cat to be substituted into the kill command.

Restart the MySQL server with the special --skip-grant-tables option:

shell> mysqld_safe --skip-grant-tables &

Set a new password for the root@localhost MySQL account:

shell> mysqladmin -u root flush-privileges password "newpwd"

Replace ``newpwd'' with the actual root password that you want to use.

You should now be able to

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus