Change and Reset MySQL root Password Thay đổi và Thiết lập lại mật khẩu root MySQL

Other then the ways specified Khác sau đó là cách xác định here ở đây to reset and change the root password for mySQL database in the case that the password is forgotten or lost, the following instructions explain in details the alternative way at the last part of the guide, where no additional file needs to be created: để thiết lập lại và thay đổi mật khẩu chủ cho các cơ sở dữ liệu mySQL trong trường hợp đó là quên mật khẩu hoặc mất, các hướng dẫn sau đây giải thích chi tiết các cách khác ở phần cuối của hướng dẫn, nơi không có tập tin bổ sung cần phải được tạo ra:

  1. Login as root to the Windows or Unix-like (Unix, Linux or BSD) machine with the MySQL server. Đăng nhập như là người chủ của Windows hoặc * nix (Unix, Linux hay BSD) máy với máy chủ MySQL.
  2. Stop the MySQL server by using either of the following command: Ngừng máy chủ MySQL bằng cách sử dụng một trong hai lệnh sau đây:

    Linux: /etc/rc.d/init.d/mysql stop Linux: / etc / rc.d / init.d / mysql stop
    FreeBSD: /usr/local/etc/rc.d/mysql-server.sh stop FreeBSD: / usr / local / etc / rc.d / mysql-server.sh dừng

  3. Open the mysql server startup script (ie mysql-server.sh – the file executed to start or stop MySQL server. Mở các tập lệnh khởi động máy chủ mysql (tức là mysql-server.sh - file thực thi để bắt đầu hoặc ngừng máy chủ MySQL.
  4. Add –skip-grant-tables to the end of the line that contains the mysqld_safe command as its parameter. Add-skip-cấp-bàn đến hết dòng chứa lệnh mysqld_safe như tham số của nó.
  5. Start MySQL server with the following command: Bắt đầu máy chủ MySQL với lệnh sau đây:

    Linux: /etc/rc.d/init.d/mysql start Linux: / etc / rc.d / init.d / mysql start
    FreeBSD: /usr/local/etc/rc.d/mysql-server.sh start FreeBSD: / usr / local / etc / rc.d / mysql-server.sh bắt đầu

  6. Alternatively, start the MySQL server directly and skip the editing with the following command: Ngoài ra, bắt đầu các máy chủ MySQL trực tiếp và bỏ qua chỉnh sửa với lệnh sau đây:

    mysqld_safe –skip-grant-tables & mysqld_safe-skip-grant-tables &

    Depending on your path environment, you may need to point to the correct directory where mysqld_safe is instead. Tùy thuộc vào môi trường đường dẫn của bạn, bạn có thể cần để trỏ đến các thư mục chính xác nơi mysqld_safe được thay thế.

  7. Run the following commands to login as the mysql user and connect to mysql user/permission database: Chạy các lệnh sau đây để đăng nhập như là người sử dụng mysql và kết nối với người sử dụng mysql / cơ sở dữ liệu cho phép:

    # mysql -u root mysql # Mysql-u root mysql

  8. Run the update queries to change the MySQL password: Khởi động cập nhật các truy vấn để thay đổi mật khẩu MySQL:

    mysql> UPDATE user SET Password=PASSWORD('newrootpassword') WHERE User='root'; mysql> UPDATE user SET Password = PASSWORD ( 'newrootpassword') WHERE User = 'root';
    mysql> FLUSH PRIVILEGES; mysql> FLUSH PRIVILEGES;

    Note: Replace newrootpassword with the new root password for MySQL server. Lưu ý: Thay thế newrootpassword với mật khẩu chủ mới cho máy chủ MySQL. Flush Privileges is needed to making the password change effect immediately. Xóa đặc quyền là cần thiết để thực hiện các thay đổi mật khẩu có hiệu lực ngay lập tức.

  9. Exit mysql database client by typing exit. Thoát khỏi mysql cơ sở dữ liệu khách hàng bằng cách nhập xuất cảnh.
  10. Stop MySQL server with commands listed at step 2. Ngừng máy chủ MySQL với các lệnh được liệt kê ở bước 2.
  11. Open the mysql server startup script edit in step 3 again and remove the –skip-grant-tables parameter that has been added. Mở máy chủ mysql khởi động kịch bản sửa trong bước 3 lần nữa và loại bỏ các-skip-cấp-bảng thông số đó đã được thêm.
  12. Start MySQL server by using command from step 5 or 6. Bắt đầu bằng cách sử dụng máy chủ MySQL lệnh từ bước 5 hoặc 6.

For Redhat Linux users, use the following instructions as the root user of Redhat Linux machine: Đối với người dùng Linux Redhat, sử dụng các hướng dẫn sau đây như là người dùng gốc của máy Redhat Linux:

  1. Stop MySQL process by using command: Stop MySQL quá trình bằng cách sử dụng lệnh:

    # killall mysqld # Killall mysqld

  2. Start the MySQL server with following options: Bắt đầu máy chủ MySQL với các tùy chọn sau đây:

    # /usr/libexec/mysqld -Sg –user=root & # / Usr / libexec / mysqld-Vn-user = root &

  3. Start the MySQL client: Bắt đầu các khách hàng MySQL:

    # mysql # Mysql

    You should see the following message: Bạn sẽ thấy thông điệp sau đây:

    Welcome to the MySQL monitor. Chào mừng đến với màn hình MySQL. Commands end with ; or g. Lệnh kết thúc bằng; hoặc g.
    Your MySQL connection id is 1 to server version: 3.xx.xx MySQL id của bạn là 1 kết nối đến máy chủ phiên bản: 3.xx.xx

    Type 'help;' or 'h' for help. Loại 'giúp đỡ;' hoặc 'h' để được giúp đỡ. Type 'c' to clear the buffer. Type 'c' để xóa bộ đệm.

    mysql> mysql>

  4. Use mysql database: Sử dụng cơ sở dữ liệu mysql:

    mysql> USE mysql mysql> USE mysql

    You should see the following message: Bạn sẽ thấy thông điệp sau đây:

    Reading table information for completion of table and column names Đọc thông tin bảng để hoàn thành bảng và cột tên
    You can turn off this feature to get a quicker startup with -A Bạn có thể tắt tính năng này để có được một khởi động nhanh hơn với-A

    Database changed Cơ sở dữ liệu thay đổi

  5. Then, update the password for the root user with the following command: Sau đó, cập nhật mật khẩu cho người dùng root với lệnh sau đây:

    UPDATE user SET password=password(”newpassword”) WHERE user=”root”; UPDATE mật khẩu Set user = mật khẩu ( "Newpassword") WHERE user = "root";

    Replace newpassword with your desired password. Thay thế Newpassword với mật khẩu mong muốn của bạn. You should see the following message: Bạn sẽ thấy thông điệp sau đây:

    Query OK, 2 rows affected (0.03 sec) Query OK, 2 hàng bị ảnh hưởng (0,03 giây)
    Rows matched: 2 Changed: 2 Warnings: 0 Rows matched: 2 Changed: 2 Warnings: 0

    Rows affected may be different, but the Query OK should be there. Hàng bị ảnh hưởng có thể khác nhau, nhưng OK Truy vấn nên có.

  6. Flush the database privileges to reload it in order to make the changes effective: Tuôn ra những đặc quyền cơ sở dữ liệu để tải lại nó để thực hiện những thay đổi có hiệu quả:

    mysql> flush privileges; mysql> flush privileges;

    You should get the following result: Bạn sẽ nhận được kết quả như sau:

    Query OK, 0 rows affected (0.02 sec) Query OK, 0 hàng bị ảnh hưởng (0,02 giây)

  7. Exit the MySQL client by typing exit. Thoát khỏi các khách hàng bằng cách gõ MySQL thoát.
  8. Kill the MySQL server process by typing killall mysqld. Giết chết quá trình máy chủ MySQL bằng cách gõ killall mysqld.
  9. Then start MySQL again: Sau đó bắt đầu MySQL một lần nữa:

    /etc/init.d/mysqld start / etc / init.d / mysqld start

IMPORTANT : The page is machine translated and provided "as is" without warranty. Quan trọng: Sửa là máy dịch và cung cấp "như là" không có bảo hành. Machine translation may be difficult to understand. Máy dịch thuật có thể khó hiểu. Please refer to Vui lòng tham khảo original English article bản gốc tiếng Anh bài viết whenever possible. bất cứ khi nào có thể.


10 Responses to “Change and Reset MySQL root Password” 10 Responses to "Thay đổi và Thiết lập lại mật khẩu root MySQL"

  1. Matt J. Matt J.
    September 20th, 2009 00:19 20 tháng chín 2009 00:19
    10 10

    I see it worked under Ubuntu for 'trail', but it did not work for me. Tôi nhìn thấy nó làm việc theo Ubuntu cho 'trail', nhưng nó không làm việc cho tôi.

    On the contrary: even after following Rajesh's suggestion to use “–skip-grant-tables” instead of “-skip-grant-tables”, even after correcting the erroneous reference to “/etc/rc.d/init.d” for Linux (my Ubuntu has no such directory, it has only “/etc/init.d/”) I get strange error messages by the time I get to step 7. Trên trái: ngay cả sau khi Rajesh gợi ý sau đây để sử dụng "-skip-cấp-bảng" thay vì "-skip-cấp-bàn", ngay cả sau khi điều chỉnh các tham chiếu sai đến "/ etc / rc.d / init.d" cho Linux (Ubuntu của tôi không có thư mục như vậy, nó chỉ có "/ etc / init.d /") tôi nhận được thông báo lỗi kỳ lạ bởi thời gian tôi nhận được đến bước 7.

    It seems either one of two things goes wrong. Có vẻ như hoặc là một trong hai điều khi gặp sự cố. Either 1) the server process starts, then soon dies or 2) if it finds the process running at all, it still gives me “ERROR 1045 (28000): Access denies for 'root'@'localhost' (using password: NO)” Hoặc 1) máy chủ bắt đầu quá trình, sau đó sớm chết hoặc 2) nếu nó tìm thấy quá trình hoạt động ở tất cả, nó vẫn mang lại cho tôi "ERROR 1045 (28000): Truy cập chối cho 'root' @ 'localhost' (sử dụng mật khẩu: NO) "

    What has my even more baffled is that I get this last message when trying to start and stop mysql! Thậm chí cả những gì đã có vách ngăn của tôi hơn là tôi nhận được tin nhắn này cuối khi cố gắng bắt đầu và ngừng mysql!

    Finally, the instructions to edit mysql are highly misleading: one cannot put “–skip-grant-tables” at the END of the line, since the line ends with redirection and '&'. Cuối cùng, các hướng dẫn để sửa mysql rất sai lạc: một không thể đặt "-skip-cấp-bảng" tại END dòng, kể từ dòng kết thúc bằng chuyển hướng và '&'. The line now reads: Hiện dòng lần đọc:

    “/usr/bin/mysqld_safe –skip-grant-tables > /dev/null 2>&1 &” "/ Usr / bin / mysqld_safe-skip-cấp bảng> / dev / null 2>-& 1 &"

    I am running the very latest released Ubuntu, with all updates as of yesterday. Tôi đang rất phát hành mới nhất của Ubuntu, với tất cả các bản cập nhật như của ngày hôm qua.

  2. Reset MySQL Root Password (for Windows) « Noel's Techie Blog Reset MySQL Root Password (cho Windows) «Noel Techie's Blog
    August 8th, 2009 10:57 Ngày 08 tháng 8 2009 10:57
    9 9

    [...] This article was written based on information from [...] Bài viết này được viết dựa trên thông tin từ http://www.mydigitallife.info/2006/06/06/change-and-reset-mysql-root-password/ http://www.mydigitallife.info/2006/06/06/change-and-reset-mysql-root-password/ to illustrate changing the mysql password on [...] để minh họa cho việc thay đổi mật khẩu mysql trên [...]

  3. ap ap
    March 12th, 2009 17:35 Ngày 12 tháng 3 năm 2009 17:35
    8 8

    @trail: Worked like a charm, thanks! @ đường mòn: Worked like a charm, thanks!

  4. trail đường mòn
    September 23rd, 2008 17:22 Ngày 23 tháng 9 năm 2008 17:22
    7 7

    worked for me on ubuntu, in just one line: làm việc cho tôi trên Ubuntu, chỉ trong một dòng:

    sudo dpkg-reconfigure mysql-server-5.0 sudo dpkg-reconfigure mysql-server-5,0

  5. Rajesh Cheethirala Rajesh Cheethirala
    July 3rd, 2008 05:46 3 tháng 7 năm 2008 05:46
    6 6

    On ubuntu, command is mysqld_safe –-skip-grant-tables & Trên Ubuntu, lệnh là mysqld_safe - skip-grant-tables &

    Extra dash is required so mysql can parse it correctly. Dash bổ sung được yêu cầu như vậy mysql có thể phân tích chính xác.

  6. Mengubah password root pada MySQL 5.0 di Windows. Mengubah mật khẩu chủ nhật MySQL 5,0 di Windows. « Iwan Binanto: “hari-hari ku yang berlalu ..” «Iwan Binanto:" hari-hari yang ku berlalu .. "
    May 5th, 2008 16:52 05 Tháng 5 2008 16:52
    5 5

    [...] judulnya), setelah googling cuma dapat cara untuk mereset dan mengganti password MySQL di UNIX-like di sini. [...] Judulnya), setelah googling cuma dapat cara untuk mereset đánh mengganti mật khẩu MySQL di UNIX như di Sini. Wah, perlu sedikit modifikasi ni … Berikut cara2 yang saya lakukan: 1. Wah, perlu sedikit modifikasi bởi ... kế tiếp của tôi cara2 thấy lakukan: 1. Kill proses MySQL [...] Giết proses MySQL [...]

  7. links for 2007-04-23 | Patrick Kempf liên kết cho ngày 23 tháng 4 năm 2007 | Patrick Kempf
    April 23rd, 2007 08:23 23 Tháng 4 2007 08:23
    4 4

    [...] Change and Reset MySQL root Password » My Digital Life (tags: mysql administration) No Tags Gelesen: 2 / heute: 2 [...] [...] Thay đổi và gốc Đặt lại mật khẩu MySQL »My Digital Life (tags: mysql hành chính) Không có Gelesen Tags: 2 / heute: 2 [...]

  8. Help me retrieve my password - Geeks Talk Giúp tôi lấy lại mật khẩu - Geeks Talk
    December 19th, 2006 14:54 19 Tháng Mười Hai 2006 14:54
    3 3

    [...] Re: Help me retrieve my password Try this link… Change and Reset MySQL root Password [...] Re: giúp tôi lấy lại mật khẩu Hãy thử liên kết này ... Thay đổi và Thiết lập lại mật khẩu root MySQL

  9. Vincitore Vincitore
    July 9th, 2006 12:05 Ngày 09 tháng 7 2006 12:05
    2 2

    I wanna reset my ZXDSL 831 ADSL Modemn Tôi muốn đặt lại ZXDSL của tôi 831 ADSL Modemn
    Plz tell me the way how to reset it Plz cho tôi biết cách làm thế nào để đặt lại nó
    I need to do that right now Tôi cần phải làm điều đó ngay bây giờ

    Best Rgds Best Rgds
    dugger(vincitore) dugger (vincitore)

  10. Reset the Root Password of MySQL Server » My Digital Life Đặt lại mật khẩu chủ của MySQL Server »My Digital Life
    June 6th, 2006 18:18 06 Tháng Sáu Năm 2006 18:18
    1 1

    [...] Alternatively, on any platform, mysql client can be used to set the new password, althought it's less secure way of resetting the password (detailed instruction here): [...] [...] Ngoài ra, trên nền tảng nào, khách hàng mysql có thể được dùng để đặt mật khẩu mới, mặc dù nó kém an toàn hơn cách đặt lại mật khẩu (chỉ dẫn chi tiết tại đây): [...]

Leave a Reply Để lại một trả lời

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Bạn có thể sử dụng các thẻ: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q <strike> <strong>

Subscribe to comments feature has been disabled. Thuê bao với ý kiến đều đã bị vô hiệu hoá. To receive notification of latest comments posted, subscribe to Để nhận được thông báo mới nhất đăng ý kiến, đăng ký với My Digital Life Comments RSS feed My Digital Life kiến RSS feed or hoặc register to receive đăng ký để nhận được new comments in daily email digest. Các ý kiến mới trong email tiêu hàng ngày.
Custom Search

New Articles Bài viết mới

Incoming Search Terms for the Article Tìm đến các Điều khoản Điều

reset mysql password mysql đặt lại mật khẩu - -- mysql change root password mysql thay đổi mật khẩu root - -- mysql password reset mysql đặt lại mật khẩu - -- change mysql root password thay đổi mật khẩu root mysql - -- mysql reset password mysql đặt lại mật khẩu - -- mysql password recovery mysql khôi phục mật khẩu - -- ubuntu mysql default password ubuntu mysql mặc định mật khẩu - -- ubuntu mysql password ubuntu mysql mật khẩu - -- how to reset mysql password làm thế nào để đặt lại mật khẩu mysql - -- reset mysql root password mysql gốc đặt lại mật khẩu - -- retrieve mysql password lấy lại mật khẩu mysql - -- reset password mysql khôi phục mật khẩu mysql - -- mysql root password change mysql gốc thay đổi mật khẩu - -- retrieve mysql root password lấy lại mật khẩu chủ mysql - -- reset mysql password linux đặt lại mật khẩu mysql linux - -- change root password mysql thay đổi mật khẩu root mysql - -- mysql root password reset mysql gốc khôi phục mật khẩu - -- mysql reset root password mysql đặt lại mật khẩu root - -- ubuntu mysql root password ubuntu mysql root mật khẩu - -- ubuntu reset mysql root password ubuntu đặt lại mật khẩu root mysql - -- mysql change password mysql thay đổi mật khẩu - -- ubuntu mysql root ubuntu mysql gốc - -- resetting mysql password đặt lại mật khẩu mysql - -- mysql default password mysql mặc định mật khẩu - -- set password mysql thiết lập mật khẩu mysql - -- how to change mysql root password làm thế nào để thay đổi mật khẩu root mysql - -- mysql retrieve password mysql lấy lại mật khẩu - -- set mysql root password thiết lập mật khẩu chủ mysql - -- lost mysql password mất mật khẩu mysql - -- default mysql password ubuntu mysql mật khẩu mặc định ubuntu - -- mysql ubuntu default password mysql ubuntu mặc định mật khẩu - -- linux mysql reset password linux mysql đặt lại mật khẩu - -- how to reset mysql root password làm thế nào để đặt lại mật khẩu chủ mysql - -- mengganti password mysql mengganti mật khẩu mysql - -- mysql root password recovery mysql gốc khôi phục mật khẩu - -- how to retrieve mysql password làm thế nào để lấy lại mật khẩu mysql - -- ubuntu mysql stop ubuntu mysql dừng - -- change mysql password mysql thay đổi mật khẩu - -- mysql password change mysql thay đổi mật khẩu - -- mysql ubuntu password mysql ubuntu mật khẩu - -- reset mysql root password ubuntu mysql đặt lại mật khẩu root ubuntu - -- change password mysql thay đổi mật khẩu mysql - -- clear mysql root password mysql gốc rõ ràng mật khẩu - -- reset mysql database password cơ sở dữ liệu mysql đặt lại mật khẩu - -- how to change mysql root password in windows làm thế nào để thay đổi mật khẩu root mysql trong cửa sổ - -- retrieve root password mysql mysql lấy lại mật khẩu chủ - -- mysql change root pass mysql thay đổi gốc qua - -- how to reset password in mysql làm thế nào để đặt lại mật khẩu trong mysql - -- mysql changing root password mysql thay đổi mật khẩu root - -- linux mysql password reset linux mysql đặt lại mật khẩu - --