如何復原或重設您的管理員密碼?

This page is a translated version of the page How do you recover or reset your admin password? and the translation is 47% complete.

Other languages:
Deutsch • ‎Ελληνικά • ‎English • ‎español • ‎eesti • ‎فارسی • ‎français • ‎italiano • ‎Nederlands • ‎português • ‎português do Brasil • ‎русский • ‎ไทย • ‎Türkçe • ‎中文(中国大陆)‎ • ‎中文(台灣)‎
Joomla! 1.5 密碼復原

這個頁面只適用於 Joomla! 2.5 以上版本。如果你是使用 Joomla! 1.5, 請參閱這裡的指示。.

一般來講,你可以從後台隨意新增、編輯和刪除每個帳戶和他們的密碼,但要達到這個目標,你必須先身為超級管理員群組的一員。

在一些情況下,你可能無法執行上面陳述的動作。例如,你的網站可能被「駭入」,然後帳號名稱和密碼都被改掉了;或者你印象中的密碼太舊,早已不適用了;或者你根本已經忘記密碼。

一些案例中,仍可以從調整 Joomla! 資料庫的設定來讓你可以再以超級管理員的身份重新登入,這方式只有對 Joomla! 網站的管理員有效。

方式 1:configuration.php 檔案

如果你具有對 Joomla! 網站的 configuration.php 存取權利,那這個復原密碼方式就是可行的。

1. 使用一個 FTP 連線程式連接你的網站。找到「configuration.php」並查看它的檔案權限。如果檔案的權限是 444 或是其他值,請一律將「configuration.php」的檔案權限調整到 644。這會避免等一下我們上傳 configuration.php 時可能造成的問題。

2. 下載 configuration.php 檔案。

3. 使用文字編輯器(ex. Notepad++)打開它,加入這一行:

public $root_user='myname';

到檔案的最下面。其中,myname 指的是一個你知道密碼,且有管理員存取能力的帳戶名稱。作者或更高層級的帳戶名稱也可以使用,以替代具有管理員存取能力的帳戶。

4. 儲存 configuration.php 並上傳回網站。剛剛被改過的權限可以不用再改回來沒關係。

這使用者將會是一個暫時的超級管理員。

5. 重新登入後台,更改那個你原本不知道密碼的管理員帳戶,或者建立一個新的超級管理員帳戶。 若你決定創立一個新的帳戶,你可根據自己的情況封鎖或是刪除你原本的帳戶。

6. 完成之後,

7. Using your FTP program verify the file permissions of the configuration.php file, they should be 444. If you manually removed the added line, then change the file permissions on the configuration.php file to 444.

If you have no users who know their passwords and you can't utilize front end registration you may need to make a change in your database as outlined below in this document.


Method 2: Direct Editing of Database

If the methods above did not work, you have two other options, both of which require working with the MySQL database directly.

Change the Password in the Database

If the admin user is still defined, the simplest option is to change the password in the database to a known value. This requires that you have access to the MySQL database using phpMyAdmin or another client.

Stop hand nuvola.svg.png
Make sure you change your password once you regain access

These instructions show how to manually change a password to the word - "secret"


  1. Navigate to phpMyAdmin and select the database for the Joomla! site in the left-hand drop-down list box. This will show the database tables on the left side of the screen.
  2. Find and click on the table with "_users" appended in the list of tables (note: you may have a prefix that is not jos_, simply go to the _users table for your prefix).
  3. Click on the "Browse" button in the top toolbar. This will show all of the users that are set up for this site.
  4. Find the user whose password you want to change and press the Edit icon for this row.
  5. A form will display that allows you to edit the password field. Copy the value
    d2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199
    
    into the password field and press the Go button. phpMyAdmin should display the message "Affected rows: 1". At this point, the password should be changed to "secret".
  6. Log in with this user and password and change the password of this user to a secure value. Check all of the users using the User Manager to make sure they are legitimate. If you have been hacked, you may want to change all of the passwords on the site.

Add a New Super Administrator User

If changing the password won't work, or you aren't sure which user is a member of the Super Administrator group, you can use this method to create a new user.

  1. Navigate to phpMyAdmin and select the database for the Joomla! site in the left-hand drop-down list box. This will show the database tables on the left side of the screen.
  2. Press the "SQL" button in the toolbar to run an SQL query on the selected database. This will display a field called "Run SQL query/queries on database <your database>".
  3. Delete any text in this field and copy and paste the following query below and press the Go button to execute the query and add the new Administrator user to the table.
  4. Use the SQL query below to add another administrator account.


Stop hand nuvola.svg.png
Make sure you match your db table prefix!

The following code uses jos31_ as the table name prefix which is only an example table prefix. The prefix when you first installed Joomla is RANDOM or what you set it specifically too. You will need to change all occurrences of jos31_(your install set prefix) found in the code below to the prefix your installation is using.


SQL code for use with Joomla Joomla 2.5 Joomla 3.1

INSERT INTO `jos31_users`
   (`name`, `username`, `password`, `params`)
VALUES ('Administrator2', 'admin2',
    'd2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199', '');
INSERT INTO `jos31_user_usergroup_map` (`user_id`,`group_id`)
VALUES (LAST_INSERT_ID(),'8');

At this point, you should be able to log into the back end of Joomla! with the username of "admin2" and password of "secret". After logging in, go to the User Manager and change the password to a new secure value and add a valid e-mail address to the account. If there is a chance you have been "hacked", be sure to check that all users are legitimate, especially any members of the Super Administrator group.

Stop hand nuvola.svg.png
Warning!

Warning: The password values shown on this page are public knowledge and are only for recovery. Your site may be hacked if you do not change the password to a secure value after logging in. Be sure you change the password to a secure value after logging in.


The examples above change the password to "secret". Two other possible values are shown below:

- password = "this is the MD5 and salted hashed password"
------------------------------------------------------
- admin  = 433903e0a9d6a712e00251e44d29bf87:UJ0b9J5fufL3FKfCc0TLsYJBh2PFULvT
- secret = d2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199
- OU812  = 5e3128b27a2c1f8eb53689f511c4ca9e:J584KAEv9d8VKwRGhb8ve7GdKoG7isMm
Advertisement