Hướng dẫn reset pass mysql windows và Linux | VN-Zoom | Cộng đồng Chia Sẻ Kiến Thức Công Nghệ và Phần Mềm Máy Tính

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We need money to operate the site, and almost all of it comes from our online advertising.

If possible, please support us by clicking on the advertisements.

Please add vn-z.vn to your ad blocking whitelist or disable your adblocking software.

×

Hướng dẫn reset pass mysql windows và Linux

VNZ-ROAD

NEXTVNZ
Tổng Hợp Cách Reset Pass Mysql ! (window và linux)

MySQL trên Windows
1.Dừng dịch vụ MySQL
C:\Program Files\MySQL\MySQL Server 5.0\bin\>net stop mysql
2.Đăng nhập vào MySQL server mà không cần mật khẩu
Mở CMD và chạy lệnh 2 lệnh này:
C:\Program Files\MySQL\MySQL Server 5.0\bin\>mysqld.exe -u root --skip-grant-tables
Mở thêm cửa sổ CMD mới rồi chạy dòng lệnh dưới nhé:
C:\Program Files\MySQL\MySQL Server 5.0\bin\>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14 to server version: 5.0.24a-community-nt
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>use mysql;
Database changed
3.Thay đổi mật khẩu root tại đây:
Chạy câu lệnh SQL này
mysql>update user set Password=PASSWORD(‘mật khẩu mới’) WHERE User=’root’;
Query OK, 3 rows affected (0.01 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql>exit
Bye
4.Hủy bỏ tiến trình mysqld-nt.exe và khởi động lại dịc vụ MySQL là xong.
C:\Program Files\MySQL\MySQL Server 5.0\bin\>taskkill /PID 1234
C:\Program Files\MySQL\MySQL Server 5.0\bin\>net start mysql

MySQL trên Unix
Trường hợp cài = source:
Làm tương tự như trên windows
1.Dừng dịch vụ MySQL
Chạy lệnh này
#service mysql stop
2.Đăng nhập vào MySQL server mà không cần mật khẩu
Nếu sử dụng RedHat, CentOS(Ubutun—>safe_mysqld –skip-grant-tables –skip-networking) thì chạy lệnh này:
# /mysqld_safe –skip-grant-tables –skip-networking
3.Thay đổi mật khẩu root tại đây:
#/usr/bin/mysql -u root
#mysql>use mysql;
#mysql>update user set Password=PASSWORD(‘mật khẩu mới’) WHERE User=’root’;FLUSH PRIVILEGES;
#/usr/bin/killall -9 mysqld
#service mysql start
Trường hợp cài đặt bằng gói RPM:
1.Dừng dịc vụ MySQL
# /etc/init.d/mysqld stop
2.Đăng nhập vào MySQL server mà không cần mật khẩu
Nếu sử dụng RedHat, CentOS(Ubutun—>safe_mysqld –skip-grant-tables –skip-networking) thì chạy lệnh này:
# /mysqld_safe –skip-grant-tables –skip-networking
3.Thay đổi mật khẩu root tại đây:
# mysqladmin -u root flush-privileges password “mật khẩu mới”
Hủy tiến trình mysql_safe
#kill ‘cat /var/run/mysqld/mysqld.pid’
#/etc/init.d/mysqld start
Thử sử dụng mật khẩu mới xem thế nào
#mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.20-standard
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
Vậy là ok .
 


Top