Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Ngừng lần đầu tiên MySQL:

  1. Truy cập: 'Tùy chọn hệ thống' >> 'MySQL' và dừng MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server Bắt đầu
  2. sudo /usr/local/mysql/support-files/mysql.server dừng
  3. sudo /usr/local/mysql/support-files/mysql.server trạng thái

Xử lý để đặt lại Pass gốc MySQL trong Mac:

  1. Hãy chắc chắn rằng bạn đã dừng MySQL trước (ở trên).

  2. Chạy máy chủ ở chế độ an toàn với đặc quyền bỏ qua:

    mysql -u root
    
    mysql> USE mysql;
    mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    4

  3. Trong một cửa sổ mới kết nối với cơ sở dữ liệu, đặt mật khẩu mới và xóa các quyền & thoát:

    mysql -u root
    
    mysql> USE mysql;
    mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    5

  4. Đối với MySQL cũ hơn MySQL 5.7 sử dụng::

    UPDATE mysql.user SET Password=PASSWORD('rootpass') WHERE User='root';

    Đối với MySQL 5.7+ sử dụng:

    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';

  5. Bây giờ các đặc quyền tuôn ra:

  6. Khởi động lại máy chủ MySQL.

  7. Thông tin thêm: http://stackoverflow.com/questions/6474775/sin http://stackoverflow.com/questions/6474775/setting-the-mysql-root-user-password-on-os-x

Tôi vừa cài đặt MySQL trên Mac OS X. Bước tiếp theo là đặt mật khẩu người dùng gốc, vì vậy tôi đã thực hiện điều này tiếp theo:

  1. Khởi chạy ứng dụng Terminal để truy cập dòng lệnh UNIX.

  2. Trong lời nhắc Unix, tôi đã thực hiện các lệnh này:

    cd /usr/local/mysql/bin
    ./mysqladmin -u root password 'password'
    

Nhưng, khi tôi thực thi lệnh

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
6, đây là câu trả lời:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 224
Server version: 5.5.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Tôi có thể vào dòng lệnh

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
7 mà không cần bất kỳ mật khẩu nào!

Tại sao điều này?

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã hỏi ngày 24 tháng 6 năm 2011 lúc 23:37Jun 24, 2011 at 23:37

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Hãy thử lệnh

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
8 khi bạn đăng nhập vào thiết bị đầu cuối MySQL. Nếu điều đó không hoạt động, hãy thử tập hợp các lệnh sau trong khi ở đầu cuối MySQL

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

Thay đổi NewPassword bằng bất kỳ mật khẩu nào bạn muốn. Nên được thiết lập!

CẬP NHẬT: Kể từ MySQL 5.7, trường

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
9 đã được đổi tên thành
mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
0. Khi thay đổi mật khẩu, sử dụng truy vấn sau để thay đổi mật khẩu. Tất cả các lệnh khác vẫn giữ nguyên:
: As of MySQL 5.7, the
mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
9 field has been renamed
mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
0. When changing the password, use the following query to change the password. All other commands remain the same:

mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';

Đối với MySQL 8.0+ không sử dụng

mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 

Khi nó ghi đè lên

mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
0, được cho là một hàm băm và không phải là văn bản đơn giản, thay vào đó hãy sử dụng:

mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 24 tháng 6 năm 2011 lúc 23:58Jun 24, 2011 at 23:58

ScottscottScott

6.6069 Huy hiệu vàng39 Huy hiệu bạc46 Huy hiệu đồng9 gold badges39 silver badges46 bronze badges

11

Nếu bạn không nhớ mật khẩu bạn đặt cho root và cần đặt lại, hãy làm theo các bước sau:

  1. Dừng máy chủ MySQLD, điều này thay đổi mỗi lần cài đặt

  2. Chạy máy chủ ở chế độ an toàn với đặc quyền bỏ qua

    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    2

  3. Trong một cửa sổ mới kết nối với cơ sở dữ liệu, đặt mật khẩu mới và xóa các quyền & thoát khỏi:

    mysql -u root
    
    mysql> USE mysql;
    mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    5

    Đối với MySQL cũ hơn MySQL 5.7 sử dụng:

    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    4

    Đối với MySQL 5.7+ sử dụng:

    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    5

    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    6

    Làm mới và bỏ:

    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    7

    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    8

  4. Dừng máy chủ chế độ an toàn và khởi động lại máy chủ thông thường của bạn. Mật khẩu mới sẽ hoạt động ngay bây giờ. Nó hoạt động như một bùa mê cho tôi :)


Ghi chú

Chạy

mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
9 Nếu bạn không muốn đặt mật khẩu cho người dùng gốc. Hoặc nếu hàm
mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
0 không hoạt động cho bạn.

Jerrymouse

16K16 Huy hiệu vàng72 Huy hiệu bạc89 Huy hiệu đồng16 gold badges72 silver badges89 bronze badges

Đã trả lời ngày 4 tháng 4 năm 2014 lúc 0:10Apr 4, 2014 at 0:10

Radtekradtekradtek

32.4K11 Huy hiệu vàng138 Huy hiệu bạc110 Huy hiệu đồng11 gold badges138 silver badges110 bronze badges

9

Khi bạn đã cài đặt MySQL, bạn sẽ cần thiết lập mật khẩu "gốc". Nếu bạn không thiết lập mật khẩu gốc, thì, không có mật khẩu gốc và bạn không cần mật khẩu để đăng nhập.

Vì vậy, điều đó đang được nói, bạn cần thiết lập một mật khẩu gốc.

Sử dụng thiết bị đầu cuối nhập như sau:

Cài đặt: Đặt mật khẩu người dùng gốc:

/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE

Nếu bạn đã phạm sai lầm hoặc cần thay đổi mật khẩu gốc, hãy sử dụng các mục sau:

Thay đổi mật khẩu gốc:

cd /usr/local/mysql/bin/
./mysql -u root -p
> Enter password: [type old password invisibly]

use mysql;
update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
flush privileges;
quit

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 16 tháng 4 năm 2012 lúc 22:35Apr 16, 2012 at 22:35

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Bobbobbob

7.0672 Huy hiệu vàng45 Huy hiệu bạc41 Huy hiệu đồng2 gold badges45 silver badges41 bronze badges

1

Các hướng dẫn được cung cấp trong trang web MySQL rất rõ ràng, so với các hướng dẫn đã đề cập ở trên

  1. mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    1
  2. mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    2
  3. mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    3
  4. mysql> đặc quyền tuôn ra;
  5. mysql> thay đổi người dùng 'root'@'localhost' được xác định bởi 'mynewpass';
  6. mysql>
    mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    4 hoặc ctrl + z
  7. mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    1
  8. mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    6
  9. mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    7
  10. Nhập mật khẩu mới, tức là MynewPass

Tham khảo: http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

Đã trả lời ngày 11 tháng 6 năm 2016 lúc 17:02Jun 11, 2016 at 17:02

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

2

  1. Dừng máy chủ MySQLD.
  • Mac OS X: Tùy chọn hệ thống → MySQL → Dừng máy chủ MySQL System Preferences → MySQL → Stop MySQL Server
  • Linux (từ thiết bị đầu cuối):
    mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    8
    mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
    
    8
  1. Khởi động máy chủ ở chế độ an toàn với đặc quyền bỏ qua

    • Từ thiết bị đầu cuối:
      mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
      
      9
      mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root'; 
      
      9
  2. Trong một cửa sổ thiết bị đầu cuối mới:new terminal window:

    • mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
      
      0
  3. Điều này sẽ mở máy khách dòng lệnh MySQL. Từ đây nhập:

    • mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
      
      1

    • mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
      
      7

    • mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
      
      3

  4. Dừng máy chủ MySQLD một lần nữa và khởi động lại ở chế độ bình thường.

    • Mac OS X (từ thiết bị đầu cuối):
      mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
      
      4
      mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
      
      4
    • Thiết bị đầu cuối Linux:
      mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
      
      5
      mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
      
      5

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 4 tháng 9 năm 2016 lúc 12:05Sep 4, 2016 at 12:05

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

imbondimbondimbond

1.9501 Huy hiệu vàng19 Huy hiệu bạc21 Huy hiệu đồng1 gold badge19 silver badges21 bronze badges

2

Đối với MySQL 5.7 mới, vì một số lý do, các lệnh nhị phân của MySQL không được gắn vào vỏ và bạn phải làm:

  1. Khởi động lại máy Mac sau khi cài đặt.

  2. Bắt đầu MySQL:

    Tùy chọn hệ thống → MySQL → Nút bắt đầu

  3. Chuyển đến thư mục cài đặt MySQL trong thiết bị đầu cuối:

    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    0
  4. Truy cập vào MySQL:

    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    1

    Và nhập mật khẩu ban đầu được cung cấp cho cài đặt.

  5. Trong máy khách MySQL, thay đổi mật khẩu:

    mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
    
    6

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 25 tháng 2 năm 2017 lúc 19:09Feb 25, 2017 at 19:09

DeoxyseiadeoxyseiaDeoxyseia

1.29917 Huy hiệu bạc28 Huy hiệu đồng17 silver badges28 bronze badges

0

Trong thiết bị đầu cuối, viết

mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
7 và đánh trả lại.

Nhập mật khẩu MySQL hiện tại mà bạn phải ghi chú xuống.

Và đặt mật khẩu:

mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
8

Vui lòng tham khảo tài liệu này ở đây để biết thêm chi tiết.

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 21 tháng 1 năm 2016 lúc 18:09Jan 21, 2016 at 18:09

Nitish Pareeknitish PareekNitish Pareek

2.3833 huy hiệu vàng18 Huy hiệu bạc18 Huy hiệu đồng3 gold badges18 silver badges18 bronze badges

0

Nếu bạn đã quên mật khẩu gốc MySQL, không thể nhớ hoặc muốn phá vỡ ở đó .. bạn có thể đặt lại mật khẩu cơ sở dữ liệu MySQL từ dòng lệnh trong Linux hoặc OS & NBSP; X miễn là bạn biết mật khẩu người dùng gốc của Hộp bạn đang ở:

(1) Dừng MySQL

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
2

(2) Bắt đầu nó ở chế độ an toàn:

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
3

.so open another shell/terminal window, log in without a password:

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
4

Trong lệnh cập nhật ở trên chỉ cần thay thế 'mật khẩu' bằng mật khẩu mới của riêng bạn, hãy đảm bảo giữ dấu ngoặc kép

(4) Tiết kiệm và khá

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
5

(5) Bắt đầu MySQL

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
6

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 19 tháng 2 năm 2015 lúc 12:54Feb 19, 2015 at 12:54

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Hom Bahranihom BahraniHom Bahrani

2.60726 Huy hiệu bạc23 Huy hiệu đồng26 silver badges23 bronze badges

Tôi đã giải quyết điều này bằng cách:

  1. Tắt máy chủ MySQL của tôi:
    mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
    
    9
  2. Chạy MySQL ở chế độ an toàn:
    /usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
    
    0
  3. Trong một thiết bị đầu cuối khác, đăng nhập với
    mysql -u root
    
    mysql> USE mysql;
    mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    5
  4. Trong cùng một thiết bị đầu cuối, chạy
    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    9, sau đó
    /usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
    
    3 và sau đó thoát ra với
    /usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
    
    4
  5. Dừng máy chủ chế độ an toàn bằng
    mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';` 
    
    9 và sau đó khởi động bộ phận bình thường;
    /usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
    
    6

Bây giờ bạn có thể đặt mật khẩu mới của mình với

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
7

Đã trả lời ngày 29 tháng 10 năm 2020 lúc 23:30Oct 29, 2020 at 23:30

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

LemonlemonLemon

9807 Huy hiệu bạc 30 Huy hiệu Đồng7 silver badges30 bronze badges

Không có ý kiến ​​nào trước đây đã giải quyết vấn đề trên máy Mac của tôi.

Tôi đã sử dụng các lệnh dưới đây và nó đã hoạt động.

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
8

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 16 tháng 1 năm 2020 lúc 9:16Jan 16, 2020 at 9:16

1

Khi tôi cài đặt OS & NBSP; X V10.10 (Yosemite), tôi gặp sự cố với MySQL. Tôi đã thử rất nhiều phương pháp, nhưng không có gì hoạt động. Tôi thực sự đã tìm thấy một cách khá dễ dàng. Thử thứ này đi.

  1. Đầu tiên đăng nhập vào một thiết bị đầu cuối từ các đặc quyền Super User (SU).

    /usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
    
    7

  2. Dừng MySQL

    /usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
    
    8

  3. Bắt đầu ở chế độ an toàn:

    mysql -u root
    
    mysql> USE mysql;
    mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    4

  4. Mở một thiết bị đầu cuối khác, đăng nhập dưới dạng đặc quyền SU, và sau đó, đăng nhập vào máy khách MySQL (

    mysql -u root
    
    mysql> USE mysql;
    mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    7) mà không cần mật khẩu

    mysql -u root
    
    mysql> USE mysql;
    mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    5

  5. Thay đổi mật khẩu

    cd /usr/local/mysql/bin/
    ./mysql -u root -p
    > Enter password: [type old password invisibly]
    
    use mysql;
    update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
    flush privileges;
    quit
    
    2

  6. Đặc quyền tuôn ra

    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    7

  7. Bạn đã hoàn thành bây giờ.

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 8 tháng 12 năm 2014 lúc 18:03Dec 8, 2014 at 18:03

1

Các phương pháp được đề cập trong các câu trả lời hiện tại không hoạt động cho MySQL 5.7.6 trở lên. Theo tài liệu MySQL, đây là cách được khuyến nghị.

B.5.3.2.3 Đặt lại mật khẩu gốc: Hướng dẫn chung

MySQL 5.7.6 trở lên:

cd /usr/local/mysql/bin/
./mysql -u root -p
> Enter password: [type old password invisibly]

use mysql;
update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
flush privileges;
quit
4

Tham khảo: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 16 tháng 10 năm 2018 lúc 12:52Oct 16, 2018 at 12:52

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Nếu bạn không thể nhớ mật khẩu của mình, câu trả lời của @Radtek đã làm việc cho tôi ngoại trừ trong trường hợp của tôi, tôi đã thiết lập MySQL bằng cách sử dụng Brew, điều đó có nghĩa là các bước 1 và 2 của câu trả lời của anh ấy phải được thay đổi thành:

  1. cd /usr/local/mysql/bin/
    ./mysql -u root -p
    > Enter password: [type old password invisibly]
    
    use mysql;
    update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
    flush privileges;
    quit
    
    5

  2. cd /usr/local/mysql/bin/
    ./mysql -u root -p
    > Enter password: [type old password invisibly]
    
    use mysql;
    update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
    flush privileges;
    quit
    
    6

Lưu ý: Việc thiếu

cd /usr/local/mysql/bin/
./mysql -u root -p
> Enter password: [type old password invisibly]

use mysql;
update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
flush privileges;
quit
7. the lack of
cd /usr/local/mysql/bin/
./mysql -u root -p
> Enter password: [type old password invisibly]

use mysql;
update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
flush privileges;
quit
7.

Đã trả lời ngày 19 tháng 1 năm 2018 lúc 7:07Jan 19, 2018 at 7:07

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Schminnieschminnieschminnie

511 Huy hiệu bạc3 Huy hiệu đồng1 silver badge3 bronze badges

Tôi nghĩ rằng điều này sẽ làm việc:

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
9

(Lưu ý rằng bạn có thể nên thay thế root bằng tên người dùng của mình nếu nó không phải là root.)

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 22 tháng 11 năm 2018 lúc 21:59Nov 22, 2018 at 21:59

Đây là chính xác những gì đã làm việc cho tôi:

  1. Hãy chắc chắn rằng không có quy trình MySQL nào khác đang chạy. Để kiểm tra điều này, hãy làm như sau:

    • Từ thiết bị đầu cuối, chạy lệnh này:

      cd /usr/local/mysql/bin
      ./mysqladmin -u root password 'password'
      
      0

      Nếu bất kỳ PID nào được trả lại, hãy giết nó bằng

      cd /usr/local/mysql/bin/
      ./mysql -u root -p
      > Enter password: [type old password invisibly]
      
      use mysql;
      update user set password=PASSWORD("NEW_PASSWORD_HERE") where User='root';
      flush privileges;
      quit
      
      8

    • Chuyển đến Tùy chọn hệ thống → MySQL → Kiểm tra xem có thể chạy ở bất kỳ trường hợp MYSQL nào không, hãy dừng chúng.

  2. Bắt đầu MySQL bằng lệnh:

    cd /usr/local/mysql/bin
    ./mysqladmin -u root password 'password'
    
    1
  3. Mật khẩu cho mọi người dùng được lưu trữ trong bảng mysql.user trong cột người dùng và xác thực_string tương ứng. Chúng tôi có thể cập nhật bảng như:

    cd /usr/local/mysql/bin
    ./mysqladmin -u root password 'password'
    
    2

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 25 tháng 7 năm 2018 lúc 7:50Jul 25, 2018 at 7:50

SGSSGSsgs

Huy hiệu Bạc 911 Huy hiệu Đồng1 silver badge4 bronze badges

Dừng máy chủ MySQL

/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
8

Bắt đầu MySQL ở chế độ an toàn

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
00

Thay đổi mật khẩu gốc

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
01

cd /usr/local/mysql/bin
./mysqladmin -u root password 'password'
3

Kiểm tra

Chạy

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
01

Bây giờ nhập mật khẩu mới để bắt đầu sử dụng MySQL.

Đã trả lời ngày 20 tháng 4 năm 2018 lúc 9:13Apr 20, 2018 at 9:13

ShreyasthreyasShreyas

1.88716 huy hiệu bạc33 huy hiệu đồng16 silver badges33 bronze badges

Để tham khảo MySQL 8.0.15 +, hàm Mật khẩu () không khả dụng. Sử dụng lệnh bên dưới.

Vui lòng sử dụng

cd /usr/local/mysql/bin
./mysqladmin -u root password 'password'
4

Đã trả lời ngày 24 tháng 10 năm 2019 lúc 6:58Oct 24, 2019 at 6:58

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Saurabh Vermasaurabh VermaSaurabh Verma

6151 Huy hiệu vàng14 Huy hiệu bạc27 Huy hiệu đồng1 gold badge14 silver badges27 bronze badges

Bạn có thể tắt MySQL theo cách thủ công trên Mac, bằng cách nhấp vào menu Apple và các tùy chọn hệ thống mở. Chọn bảng ưa thích của MySQUL, sau đó nhấp vào nút Dừng MySQL Server để dừng máy chủ MySQL trên máy Mac.

Sau khi bạn dừng MySQL của mình, bạn sẽ cần làm theo các bước này.

  • Bạn sẽ cần bắt đầu MySQL ở chế độ Bỏ qua Bảng cấp bảng

    cd /usr/local/mysql/bin
    ./mysqladmin -u root password 'password'
    
    5
  • Trong chính thiết bị đầu cuối của bạn, hãy nhập lệnh này để xóa các đặc quyền hiện có

    cd /usr/local/mysql/bin
    ./mysqladmin -u root password 'password'
    
    6
  • Bây giờ bạn cần thay đổi mật khẩu người dùng

    cd /usr/local/mysql/bin
    ./mysqladmin -u root password 'password'
    
    7

Sau đó, bạn có thể truy cập menu Apple và các tùy chọn hệ thống mở. Chọn bảng ưa thích của MySQUL, sau đó nhấp vào nút Dừng MySQL Server để dừng Máy chủ MySQL trên Mac.

Cuối cùng, bạn có thể một lần nữa chuyển đến menu Apple và các tùy chọn hệ thống mở. Chọn bảng ưa thích của MySQUL, sau đó nhấp vào nút Bắt đầu máy chủ MySQL của MySQL để khởi động máy chủ MySQL trên máy Mac.

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 2 tháng 12 năm 2019 lúc 19:56Dec 2, 2019 at 19:56

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Sidd Thotasidd ThotaSidd Thota

1.82219 huy hiệu bạc23 Huy hiệu đồng19 silver badges23 bronze badges

2

Cách giải quyết này hoạt động trên máy tính xách tay của tôi!

Mac với MacOS V10.14.5 (Mojave).

MySQL 8.0.17 đã được cài đặt với Homebrew.

  • Tôi chạy lệnh sau để định vị đường dẫn của mysql

    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    03

  • Khi đường dẫn được biết, tôi chạy điều này:

    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    04

  • Trong một thiết bị đầu cuối khác tôi chạy:

    mysql -u root
    
    mysql> USE mysql;
    mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    
    5

  • Bên trong thiết bị đầu cuối đó, tôi đã thay đổi mật khẩu gốc bằng cách sử dụng:

    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    06

  • Và để hoàn thành tôi chạy:

    mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
    
    7

Và voilà, mật khẩu đã được đặt lại.

Người giới thiệu

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 15 tháng 8 năm 2019 lúc 12:50Aug 15, 2019 at 12:50

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Espoir Murhabaziespoir MurhabaziEspoir Murhabazi

5.4544 Huy hiệu vàng42 Huy hiệu bạc67 Huy hiệu Đồng4 gold badges42 silver badges67 bronze badges

Hãy thử điều này trong một thiết bị đầu cuối:

cd /usr/local/mysql/bin
./mysqladmin -u root password 'password'
8

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 22 tháng 7 năm 2019 lúc 23:54Jul 22, 2019 at 23:54

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

MacOS V10.14 (Mojave) và sau đó với 5.7,26 được cài đặt từ Trình cài đặt Mac & NBSP; OS & NBSP; X DMG.

Khi cố gắng sử dụng lệnh cập nhật được đăng bởi những người dùng khác, nó sẽ dẫn đến lỗi sau:

Lỗi 1820 (HY000): Bạn phải đặt lại mật khẩu của mình bằng cách sử dụng câu lệnh của người dùng trước khi thực hiện câu lệnh này.

Sao chép mật khẩu được trình bày cho bạn bởi Trình cài đặt, mở một thiết bị đầu cuối và thực hiện như sau:

cd /usr/local/mysql/bin
./mysqladmin -u root password 'password'
9

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 21 tháng 5 năm 2019 lúc 2:21May 21, 2019 at 2:21

Cho MySQL 8

  1. Tắt máy chủ MySQL
  • Chuyển đến Tùy chọn hệ thống -> MySQL
  • Nhấp vào nút
    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    08
  1. Mở hai cửa sổ [dòng lệnh]

  2. Trong cửa sổ thiết bị đầu cuối đầu tiên chạy như sau:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 224
Server version: 5.5.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
0
  1. Trong cửa sổ thiết bị đầu cuối thứ hai làm như sau:

4.1. Đăng nhập vào MySQL

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 224
Server version: 5.5.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
1

4.2. Chạy những điều sau trong lời nhắc MySQL:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 224
Server version: 5.5.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
2

4.3. Thoát khỏi MySQL

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 224
Server version: 5.5.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
3
  1. Quay trở lại cửa sổ thiết bị đầu cuối đầu tiên và tắt máy
    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    09

5.1. Nhấn Ctrl + Z

5.2. Chạy lệnh sau

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 224
Server version: 5.5.13 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
4

5.3. Nhập mật khẩu mới bạn đặt trong

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
10 khi được nhắc.

  1. Bắt đầu máy chủ MySQL [xem
    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    11]

Đã trả lời ngày 3 tháng 3 lúc 9:55Mar 3 at 9:55

ObihillobihillObiHill

11.2K20 Huy hiệu vàng82 Huy hiệu bạc129 Huy hiệu đồng20 gold badges82 silver badges129 bronze badges

Nếu bạn quên mật khẩu hoặc muốn thay đổi nó thành MySQL của mình:

  1. Bắt đầu thiết bị đầu cuối của bạn và nhập:

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 224
    Server version: 5.5.13 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    
    5
  2. Nhập mật khẩu cho hệ thống của bạn

  3. Dừng máy chủ MySQL của bạn:

    UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
    2
  4. Để mở cửa sổ này, chạy cửa sổ thiết bị đầu cuối thứ hai và nhập vào đây:

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 224
    Server version: 5.5.13 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    
    1
  5. Và thay đổi mật khẩu của bạn cho MySQL:

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 224
    Server version: 5.5.13 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    
    8

    trong đó "new_password" - mật khẩu mới của bạn. Bạn không cần mật khẩu cũ cho MySQL.

  6. Xóa, thoát và kiểm tra mật khẩu mới của bạn:

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 224
    Server version: 5.5.13 MySQL Community Server (GPL)
    
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    
    9
  7. Đóng tất cả các cửa sổ và kiểm tra mật khẩu mới của bạn cho MySQL.

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 22 tháng 12 năm 2017 lúc 23:34Dec 22, 2017 at 23:34

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Nhiều thứ đã thay đổi cho MySQL 8. Tôi đã tìm thấy sửa đổi sau đây của tài liệu MySQL 8.0 "Cách đặt lại mật khẩu gốc" hoạt động với Mac OS X.

Tạo một tệp tạm thời,

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
12, với SQL để cập nhật mật khẩu gốc:

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
0

Điều này sử dụng

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
13 để tránh plugin xác thực 'bộ nhớ cache_sha2_password' không thể tải lỗi mà tôi nhận được nếu tôi bỏ qua tùy chọn.

Dừng máy chủ, bắt đầu với tùy chọn

UPDATE mysql.user SET authentication_string=PASSWORD("rootpass") WHERE User='root';
14 để đặt mật khẩu gốc và sau đó khởi động lại máy chủ:

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
1

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 3 tháng 8 năm 2018 lúc 15:08Aug 3, 2018 at 15:08

DJBDJBdjb

4.7971 Huy hiệu vàng34 Huy hiệu bạc37 Huy hiệu đồng1 gold badge34 silver badges37 bronze badges

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
2

Tôi bằng cách nào đó cần phải làm điều này mỗi khi MacBook của tôi khởi động lại.

Hướng dẫn how do i find mysql password on mac? - làm cách nào để tìm mật khẩu mysql trên mac?

Đã trả lời ngày 18 tháng 7 năm 2019 lúc 6:30Jul 18, 2019 at 6:30

LaFeberlafeBerlafeber

2.6131 Huy hiệu vàng26 Huy hiệu bạc29 Huy hiệu đồng1 gold badge26 silver badges29 bronze badges

mysql -u root

mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
3

https://www.houseninetytwo.com/how-to-use-mysql-in-erminal-on-mac-os-high-sierra/#: ~:Text=You%20May%20Have %2fbin%2fmysql. & Text = it%20HOULD%20EXECUTE%20THER%20right, return%20your%20version%20of%20MysQL.

Đã trả lời ngày 13 tháng 8 lúc 10:40Aug 13 at 10:40