เปลี่ยนรหัสผ่าน WordPress ด้วย SSH
คุณสามารถเปลี่ยนแปลงฐานข้อมูลผ่าน SSH ซึ่งสามารถใช้อัพเดตรหัสผ่าน WordPress ได้
คำเตือน: คุณควรสำรองข้อมูลเว็บไซต์ก่อนทำการเปลี่ยนแปลงกับฐานข้อมูลเสมอ
- You should always backup your site before performing any changes.
- Connect to your server or shared hosting account with SSH
เชื่อมต่อกับ MySQL โดยใช้คำสั่งต่อไปนี้:
mysql -u username -h host database -P port -p
ป้อนข้อมูลของฐานข้อมูลจากฐานข้อมูลของคุณดังต่อไปนี้:
- username คือชื่อผู้ใช้ฐานข้อมูลของคุณ
- host คือชื่อโฮสต์หรือที่อยู่ IP ของฐานข้อมูล
- database คือชื่อฐานข้อมูล
- port คือพอร์ตที่ MySQL ทำงานอยู่ (ค่าเริ่มต้นคือ 3306)
- เมื่อระบบถามหา ให้กรอกรหัสผ่านสำหรับผู้ใช้ MySQL นั้น
- Enter the following MySQL command to switch to your WordPress database:
mysql> use database
- database คือชื่อฐานข้อมูล
- Enter the following command to see a list of the tables in the database. Make notes of the table containing "_users".
mysql> show tables;
- Enter the following command to see the contents of your "users" table. Make note of the number in the "ID" column for the user you want to update.
mysql> SELECT * FROM table;
- table คือชื่อตารางผู้ใช้ของคุณ
- Use the following command to set your new password.
mysql> UPDATE table SET user_pass = MD5('password') WHERE ID = id;
- table is the name of the users table
- password คือรหัสผ่านใหม่ของคุณ
- id คือหมายเลขที่คุณหาเตรียมไว้ในขั้นตอนที่ 7
You can now login with your new password.