This is a translated page. The original can be found here: http://iwebdevel.com/2009/06/08/wordpress-easily-reset-your-account-password-using-mysql-and-php/
UPDATES VIA RSS | Email威盛最新的RSS | 电子邮件 Get updates via feedburner Get updates via twitter
Home / Coding / MySQL / PHP / Wordpress: Easily Reset Your… 首页 / 编码 / MySQL的 / PHP的 / WordPress的:轻松重置您...

Wordpress: Easily Reset Your Account Password Using MySQL and PHP WordPress的:轻松重置您的帐户密码使用MySQL和PHP

Posted on 08.发布08。 Jun, 2009 by Dragos in Coding , MySQL , PHP 2008年6月,2009年在编码 ,MySQL的 ,PHP的 德拉戈什

I've just forgot my admin password on my local testing blog, and what is worse – my local machine is not configured to send external email.我只是忘了我的博客我的本地测试管理员密码,更糟糕的是-我的本地机器没有配置外部发送电子邮件。 Oh yeah, got to reinstall wordpress again, what a pity.噢,获得再重新安装WordPress的,真可惜。 No way!不行! There are two ways of resetting your password using two easy methods.有两种重新使用两种简单的方法您的密码的方法。 You'll need basic knowledge of PHP or CPanel+PHPMyAdmin.你需要的基本知识的cPanel + PHP或PHPMyAdmin中。

I Method: CPanel+PHPMyAdmin余方法:PHPMyAdmin中的cPanel +

For this method, it is necessary that your host have CPanel and PHPMyAdmin installed.对于此方法,必须有你的主机的cPanel并且设置phpMyAdmin安装。 If your host doesn't have these pieces of software, but something similar to these, you can follow this tutorial and apply these steps to your situation.如果你的主机没有这些软件作品,但类似这些,您可以按照本教程和应用这些步骤,您的情况。

First we'll need to open the PHPMyAdmin page.首先我们需要给phpMyAdmin打开网页。 From the CPanel root page, launch PHPMyAdmin.从根页面的cPanel,发射PHPMyAdmin中。 The icon of PHPMyAdmin should look similar to the one emphasized in the screenshot below. PHPMyAdmin中的图标应类似于一个在下面的截图强调。

PHPMyAdmin

PHPMyAdmin PHPMyAdmin中

Once on the main page of PHPMyAdmin you should remember what database did you use when installing wordpress.一旦在主控的phpMyAdmin主页你应该记住你的数据库时使用安装WordPress。 If you don't remember, don't get angry.如果你不记得,不生气。 Go to your root folder where wordpress is installed and download & open the file wp-config.php with a simple text editor like Notepad/GEdit.转到您的根文件夹的WordPress安装和下载和打开记事本之类简单的文本编辑器中打开的wp - config.php / GEdit。 You'll need to find this line:您需要找到这行:

 define('DB_NAME', 'ABCD');定义('DB_NAME','ABCD'); 

Note that ABCD (without the single quotes around it) is the name of the database that wordpress is installed in.请注意,ABCD(不周围的单引号)是数据库的名称的WordPress安装英寸

Back on the PHPMyAdmin page, click on the link of your database name.回到PHPMyAdmin中页上,点击您的数据库名称链接。 In my case it was _iwebdevel .在我的情况是_iwebdevel。

Select your database

Select your database选择数据库

Now you'll see another PHPMyAdmin page, but this time you'll be presented all your tables contained in the ABCD database.现在,你会看到一个PHPMyAdmin中页,但您将提交您的所有 ABCD数据库中的表的时间。 We need to select the table users .我们需要选择表用户 You won't see the exact name users of this table, but a name in this format xx_users , where xx_ is the prefix of your wordpress table names.你不会看到此表的确切名称的用户 ,但这一格式xx_users,其中xx_是您的WordPress的表名前缀名称。 Click on the link of your users table ( xx_users ).点击你的用户表(xx_users)链接。 In my case, as in most cases it's wp_users :在我的情况,因为在多数情况下,它的wp_users:

Select the users table

Select the users table选择用户表

Now click on browse to see the rows contained in table xx_users .现在点击浏览 ,看看表xx_users中的行。

Click on browse

Click on browse点击浏览

Now look for the username you want to reset the password.现在看你的用户名要重置密码。 In my case I want to reset password for admin. Now click on the edit button.在我的情况,我想重新设置管理员密码现在的编辑按钮。

Edit user's details

Edit user's details编辑用户的详细资料

Now you'll need to generate an MD5 hash of the new password you would like to set.现在你需要生成一个新密码,您想设定的MD5哈希。 Go to http://seoanalytic.com/tools/md5_encryptor/ and enter your preferred password.转到http://seoanalytic.com/tools/md5_encryptor/并输入您喜好的密码。 After you enter your new password, click on the Encrypt! button.在您输入您的新密码, 加密!按钮。

Encrypt your password

Encrypt your password加密您的密码

After you've encrypted your password, select and copy the newly MD5 generated hash code.在您加密的密码,选择并复制生成新的MD5哈希码。

Select and copy the MD5 hash

Select and copy the MD5 hash选择并复制MD5哈希

Now return to your PHPMyAdmin page and paste your MD5 hash from the clipboard to the input field as shown in the image below:现在回到你的PHPMyAdmin中页面,从剪贴板粘贴到输入框,如下图所示的MD5哈希:

Paste MD5 hash in the specified input field

Paste MD5 hash in the specified input field MD5哈希粘贴在指定的输入字段

Finally click on Go button to save your new password.最后,点击转到按钮保存您的新密码。

Save new password

Save new password保存新密码

II Method: PHP二,方法:PHP的

In my opinion the second method is much faster and simpler.我认为第二种方法是变得更快更简单。 In this method you'll just have to upload a PHP file to your host and access it with a browser.在此方法你只需要一个PHP文件上传到你的主机和访问的浏览器。 But we'll talk about it a little bit later.但我们会谈论这个问题稍微晚一些。

So here's the piece of PHP code I've came up with to help you reset your wordpress account password.所以这里的PHP代码我来帮助你与你的WordPress重置帐户密码了一块。

  $newPassword='NEW_PASSWORD_GOES_HERE'; //put your new password between the single quotes $新密码='NEW_PASSWORD_GOES_HERE'; / /把单引号之间的新密码 
	 $username='admin'; //put the login username you'd like to change the password to $用户名='管理'; / /把你的登入名称要更改的密码 
	 @include_once('./wp-config.php'); //get some details from your wordpress installation @ include_once('。/的wp - config.php'); / /从你的WordPress安装的一些细节 
	 global $table_prefix;全球$ table_prefix; 
	 $conxb=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD); //establish connection to your database $ conxb = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD); / /建立连接到你的数据库 
	 mysql_select_db(DB_NAME,$conxb); mysql_select_db(DB_NAME,$ conxb); 
	 $query='update `'.$table_prefix.'users` set `user_pass`=\''.mysql_real_escape_string(md5($newPassword)).'\' where `user_login`=\''.mysql_real_escape_string($username).'\' limit 1'; $查询='更新`'。$ table_prefix。'用户的`设置`user_pass`= \ ''。mysql_real_escape_string(的MD5($新密码))。'\',其中`user_login`= \ ''。mysql_real_escape_string($用户名)。 '\'限制1'; 
	 $mQuery=mysql_query($query,$conxb); //set new password $ mQuery = mysql_query($查询,$ conxb); / /设置新密码 
	 echo $mQuery?'Successfully set new password.回声$ mQuery?'成功设置新密码。 New password: '.$newPassword:'There was an error.新密码:'。$新密码:'有一个错误。 Error: '.mysql_error(); //if result is unsuccessful you'll see the mysql error message错误:'。mysql_error(); / /如果结果是不成功,您会看到MySQL的错误信息 
	 mysql_close($conxb); mysql_close($ conxb); 

For your convenience you can download the file reset.php from here .为了方便起见,您可以下载文件reset.php。

Now extract the zip archive you've just downloaded and edit the necessary parameters to suit your needs (explanation comments are present in the PHP code above).现在,解压缩档案你刚刚下载并编辑必要的参数,以满足您的需要(解释意见出现在PHP代码段)。 Then upload the file reset.php to your wordpress root installation folder.然后上传文件到你的WordPress reset.php根安装文件夹。 To make sure that this is the right directory, look for a file named wp-config.php ,为了确保这是正确的目录,命名的wp - config.php文件看, if it's there you're on the right way, else look for the directory where wp-config.php is present and upload the file reset.php there.如果是你有正确的方法你,否则该目录看看那里的wp - config.php,是当前和上传文件reset.php那里。

Finally you'll want to go to http://yourDomainName.TLD/ reset.php .最后,你要到http://yourDomainName.TLD/ reset.php。 You'll see the appropriate message depending on how the script worked.您会看到相应的消息,具体取决于如何脚本工作。 If there is an error, post it here and I'll try to help you, else you did everything perfectly and you can now log in with your new password.如果出现错误,在这里后,我会尽力帮助你,否则你做的一切完美,现在您可以使用您的新密码登录。

Translate this post翻译这个职位





Related posts:相关岗位:

  1. Wordpress 2.8.4: Not ready to be installed with PHP 5.3 ? WordPress的2.8.4:不准备好安装使用PHP 5.3?
  2. Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script WordPress的:最佳WordPress的搜索引擎iTranslator,从全自动插件脚本免费交通
  3. PHP Error: Call to a member function fetch_assoc() on a non-object in PHP的错误:调用一个成员函数fetch_assoc()在一个非对象
  4. PHP: How to get creation time of file with PHP on Linux machines PHP:如何获得Linux的机器用PHP创建文件时间
  5. Coding:How to fetch user profile data with SSI.php from a SMF forum database 编码:如何获取从证券保证金融资论坛数据库SSI.php用户配置文件数据

    blog comments powered by Disqus 博客评论 Disqus