OR, Hãy chắc chắn rằng bạn đã dừng MySQL trước [ở trên]. Chạy máy chủ ở chế độ an toàn với đặc quyền bỏ qua: Ngừng lần đầu tiên MySQL:
Xử lý để đặt lại Pass gốc MySQL trong Mac:
4mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD["NEWPASSWORD"] WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
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Đố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';
Bây giờ các đặc quyền tuôn ra:
Khởi động lại máy chủ MySQL.
Thông tin thêm: //stackoverflow.com/questions/6474775/sin //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:
Khởi chạy ứng dụng Terminal để truy cập dòng lệnh UNIX.
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ỏi ngày 24 tháng 6 năm 2011 lúc 23:37Jun 24, 2011 at 23:37
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 MySQLmysql -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
9 đã được đổi tên thành mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD["NEWPASSWORD"] WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
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> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
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';`
Đã 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:
Dừng máy chủ MySQLD, điều này thay đổi mỗi lần cài đặt
Chạy máy chủ ở chế độ an toàn với đặc quyền bỏ qua
2mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
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:
5mysql -u root mysql> USE mysql; mysql> UPDATE user SET password=PASSWORD["NEWPASSWORD"] WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> quit
Đối với MySQL cũ hơn MySQL 5.7 sử dụng:
4mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
Đối với MySQL 5.7+ sử dụng:
5mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
6mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
Làm mới và bỏ:
7mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
8mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
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
Đã trả lời ngày 16 tháng 4 năm 2012 lúc 22:35Apr 16, 2012 at 22:35
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
1mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
2mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
3mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
- mysql> đặc quyền tuôn ra;
- mysql> thay đổi người dùng 'root'@'localhost' được xác định bởi 'mynewpass';
- mysql>
4 hoặc ctrl + zmysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
1mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
6mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
7mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
- Nhập mật khẩu mới, tức là MynewPass
Tham khảo: //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
2
- 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]:
8mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
8mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
Khởi động máy chủ ở chế độ an toàn với đặc quyền bỏ qua
- Từ thiết bị đầu cuối:
9mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
9mysql> UPDATE mysql.user SET authentication_string='password' WHERE User='root';
- Từ thiết bị đầu cuối:
Trong một cửa sổ thiết bị đầu cuối mới:new terminal window:
0mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
Điều này sẽ mở máy khách dòng lệnh MySQL. Từ đây nhập:
1mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
7mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
3mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
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]:
4mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
4mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
- Thiết bị đầu cuối Linux:
5mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
5mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
- Mac OS X [từ thiết bị đầu cuối]:
Đã trả lời ngày 4 tháng 9 năm 2016 lúc 12:05Sep 4, 2016 at 12:05
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:
Khởi động lại máy Mac sau khi cài đặt.
Bắt đầu MySQL:
Tùy chọn hệ thống → MySQL → Nút bắt đầu
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';
0Truy cập vào MySQL:
UPDATE mysql.user SET authentication_string=PASSWORD["rootpass"] WHERE User='root';
1Và nhập mật khẩu ban đầu được cung cấp cho cài đặt.
Trong máy khách MySQL, thay đổi mật khẩu:
6mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
Đã 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';`
8Vui lòng tham khảo tài liệu này ở đây để biết thêm chi tiết.
Đã 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
Đã trả lời ngày 19 tháng 2 năm 2015 lúc 12:54Feb 19, 2015 at 12:54
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:
- Tắt máy chủ MySQL của tôi:
9mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
- Chạy MySQL ở chế độ an toàn:
0/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
- Trong một thiết bị đầu cuối khác, đăng nhập với
5mysql -u root mysql> USE mysql; mysql> UPDATE user SET password=PASSWORD["NEWPASSWORD"] WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> quit
- Trong cùng một thiết bị đầu cuối, chạy
9, sau đómysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
3 và sau đó thoát ra với/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
4/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
- Dừng máy chủ chế độ an toàn bằng
9 và sau đó khởi động bộ phận bình thường;mysql> `ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';`
6/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
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
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
Đã 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.
Đầ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].
7/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
Dừng MySQL
8/usr/local/mysql/bin/mysqladmin -u root password NEW_PASSWORD_HERE
Bắt đầu ở chế độ an toàn:
4mysql -u root mysql> USE mysql; mysql> UPDATE user SET password=PASSWORD["NEWPASSWORD"] WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> quit
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 [
7] mà không cần mật khẩumysql -u root mysql> USE mysql; mysql> UPDATE user SET password=PASSWORD["NEWPASSWORD"] WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> quit
5mysql -u root mysql> USE mysql; mysql> UPDATE user SET password=PASSWORD["NEWPASSWORD"] WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> quit
Thay đổi mật khẩu
2cd /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
Đặc quyền tuôn ra
7mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
Bạn đã hoàn thành bây giờ.
Đã 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
4Tham khảo: //dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
Đã trả lời ngày 16 tháng 10 năm 2018 lúc 12:52Oct 16, 2018 at 12:52
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:
5cd /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
6cd /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
Lưu ý: Việc thiếu
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
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
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.]
Đã 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:
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:
0cd /usr/local/mysql/bin ./mysqladmin -u root password 'password'
Nếu bất kỳ PID nào được trả lại, hãy giết nó bằng
8cd /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
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.
Bắt đầu MySQL bằng lệnh:
1cd /usr/local/mysql/bin ./mysqladmin -u root password 'password'
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ư:
2cd /usr/local/mysql/bin ./mysqladmin -u root password 'password'
Đã 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
8Bắ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'
3Kiể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
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
5cd /usr/local/mysql/bin ./mysqladmin -u root password 'password'
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ó
6cd /usr/local/mysql/bin ./mysqladmin -u root password 'password'
Bây giờ bạn cần thay đổi mật khẩu người dùng
7cd /usr/local/mysql/bin ./mysqladmin -u root password 'password'
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.
Đã trả lời ngày 2 tháng 12 năm 2019 lúc 19:56Dec 2, 2019 at 19:56
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';
03Khi đườ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';
04Trong một thiết bị đầu cuối khác tôi chạy:
5mysql -u root mysql> USE mysql; mysql> UPDATE user SET password=PASSWORD["NEWPASSWORD"] WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> quit
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';
06Và để hoàn thành tôi chạy:
7mysql> UPDATE user SET authentication_string=PASSWORD["NEWPASSWORD"] WHERE User='root';
Và voilà, mật khẩu đã được đặt lại.
Người giới thiệu
Đã trả lời ngày 15 tháng 8 năm 2019 lúc 12:50Aug 15, 2019 at 12:50
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
Đã trả lời ngày 22 tháng 7 năm 2019 lúc 23:54Jul 22, 2019 at 23:54
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
Đã trả lời ngày 21 tháng 5 năm 2019 lúc 2:21May 21, 2019 at 2:21
Cho MySQL 8
- 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
Mở hai cửa sổ [dòng lệnh]
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- 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>
14.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>
24.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- 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>
45.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.
- 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:
Bắt đầu thiết bị đầu cuối của bạn và nhập:
5Welcome 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>
Nhập mật khẩu cho hệ thống của bạn
Dừng máy chủ MySQL của bạn:
UPDATE mysql.user SET authentication_string=PASSWORD["rootpass"] WHERE User='root';
2Để 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:
1Welcome 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>
Và thay đổi mật khẩu của bạn cho MySQL:
8Welcome 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>
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.
Xóa, thoát và kiểm tra mật khẩu mới của bạn:
9Welcome 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>
Đó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.
Đã trả lời ngày 22 tháng 12 năm 2017 lúc 23:34Dec 22, 2017 at 23:34
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
Đã 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
2Tô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.
Đã 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//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