• Dịch vụ Quản trị máy chủ
  • Liên hệ quảng cáo
Chủ Nhật, Tháng năm 4, 2025
  • Login
cPanel.vn
Liên hệ quảng cáo
  • Home
  • Control Panel
    • cPanel/WHM
    • Direct Admin
    • HELM
    • Hosting Controller
    • IspConfig
    • Kloxo-LxAdmin
    • LNMP
    • Plesk
    • Webmin
  • Domain/Host/Server
    • Hosting
    • Tên miền
    • VPS
  • Ảo hóa
    • Virtuozzo
    • VMWare
  • Hệ điều hành
    • Linux
    • Windows
  • Internet
    • Thủ thuật SEO
    • Nhiếp ảnh
  • Server
    • Web Server
    • Email Server
    • Database Server
      • MSSQL
      • MySQL
  • WordPress
    • Themes
No Result
View All Result
  • Home
  • Control Panel
    • cPanel/WHM
    • Direct Admin
    • HELM
    • Hosting Controller
    • IspConfig
    • Kloxo-LxAdmin
    • LNMP
    • Plesk
    • Webmin
  • Domain/Host/Server
    • Hosting
    • Tên miền
    • VPS
  • Ảo hóa
    • Virtuozzo
    • VMWare
  • Hệ điều hành
    • Linux
    • Windows
  • Internet
    • Thủ thuật SEO
    • Nhiếp ảnh
  • Server
    • Web Server
    • Email Server
    • Database Server
      • MSSQL
      • MySQL
  • WordPress
    • Themes
No Result
View All Result
cPanel.vn
No Result
View All Result

Reset password MySQL trên Linux và Windows

cPanel.vn by cPanel.vn
16/02/2011
in Linux, MySQL, Windows
Home Hệ điều hành Linux

I. Trên Windows:

Vào Start -> Run -> gõ

services.msc

Enter
Tìm services MySQL và stop lại

Sau đó bạn vào Command, tìm đến thư mục bin của MySQL:
Vào Start -> Run -> gõ: cmd  —> EnterVí dụ bạn để mysql ở C:\MySQL. Gõ lệnh sau:

C:\mySQL\bin\>mysqld-nt –skip-grant-tables

Giữ nguyên cửa số đó và mở thêm 1 cửa sổ command mới
vào bin và gõ lệnh

C:\mySQL\bin\>mysql -u root

khi đó sẽ login vào root mà không cần password.
Để Reset password root ta dùng lệnh

mysql>use mysql; update user set Password=PASSWORD(‘new_pass’) WHERE User=’root’;FLUSH PRIVILEGES;

trong đó new_pass chính là password của bạn.

II. Trên Linux:
Trường hợp cài đặt bằng gói RPM:
1. Gain root access to your Linux system – Lên quyền root:

[user@localhost ~]$ su –
Password:
[root@localhost user]#

2. First you have to stop the daemon – Dừng ngay mysql lại

[root@localhost root]# /etc/init.d/mysqld stop
[root@localhost root]#

3. Nếu sử dụng RedHat, CentOS… thì dùng

[root@localhost root]# mysqld_safe –skip-grant-tables –skip-networking
[root@localhost root]#

Nếu dùng OS khác (ubutun…) thì thay thế services mysqld_safe thành safe_mysqld

(You will now start MySQL in safe mode without reading the grant tables with all MySQL database passwords and also you will disable networking. The “safe_mysqld” command will do this trick for you. Chạy mysql trong safe_mode mà không cần đăng nhập và bạn cũng sẽ disable networking cho mysql luôn – đề phòng thằng nào nhân cơ hội này nó vào ).

4. The “mysqladmin” command will now reset[rewrite] the root password. In this case we are setting it to “newpassword”. Sử dụng mysqladmin sẽ reset lại password. Trong trường hợp này ta phải sử dụng lệnh sau để set 1 pass mới.

[root@localhost root]# mysqladmin -u root flush-privileges password “newpassword”
[root@localhost root]#

5. Stop the running daemon – Dừng chạy cái mysql_safe:

[root@localhost root]# kill `cat /var/run/mysqld/mysqld.pid`

6. And finally restart it – và cuối cùng khởi động lại:

[root@localhost root]# /etc/init.d/mysqld start
[root@localhost root]#

7. You can use now your new root password – Bây giờ thì xài pass mới xem:

[root@localhost root]# 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>

XOng.

Trường hợp cài = source:
Tìm thư mục cài đặt Mysql và tìm thư mục libexec bên trong nó. Bạn chạy lệnh :

[root@localhosthost libexec]./mysqld stop
[root@localhosthost libexec]./mysqld –skip-grant-tables –user=root

sau đó có thể tiến hành đăng nhập không cần password và reset password như trên windows

Tags: database servermysql
Previous Post

Thêm FLV MIME vào IIS Webserver

Next Post

Bị mất IUSR_Computername

Có thể bạn quan tâm

Linux Command: Hiển thị phiên bản Linux
Linux

Linux Command: Hiển thị phiên bản Linux

23/05/2014
Trải nghiệm Windows Server 2012 và nhận Lumina 710 từ Microsoft
Windows

Trải nghiệm Windows Server 2012 và nhận Lumina 710 từ Microsoft

26/09/2012
Khắc phục lỗi không start được Gene6 FTP Service trên Windows 2008
Windows

Khắc phục lỗi không start được Gene6 FTP Service trên Windows 2008

10/12/2013
Một số lệnh ẩn trong RUN
Windows

Một số lệnh ẩn trong RUN

10/12/2013
Next Post

Bị mất IUSR_Computername

Để lại một bình luận Hủy

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *

Nên xem.

We’re The Millers Soundtrack

We’re The Millers Soundtrack

10/12/2013
Khắc phục lỗi “DA appears to be using SSL. Change your script to connect to ssl” khi đổi mật khẩu Round Cube trên DirectAdmin

Khắc phục lỗi “DA appears to be using SSL. Change your script to connect to ssl” khi đổi mật khẩu Round Cube trên DirectAdmin

11/02/2022
Liên hệ quảng cáo Liên hệ quảng cáo Liên hệ quảng cáo

Đang HOT.

Khắc phục lỗi Just-In-Time Debugger

16/02/2011
Làm gì khi website báo lỗi Server Error in ‘/’ Application

Làm gì khi website báo lỗi Server Error in ‘/’ Application

25/05/2014
Hướng dẫn nhập tiếng Việt và tiên đoán ngôn ngữ trong điện thoại Nokia

Hướng dẫn nhập tiếng Việt và tiên đoán ngôn ngữ trong điện thoại Nokia

18/07/2013
Hosting miễn phí cực khủng

Hosting miễn phí cực khủng

05/11/2017
Xóa Log File trong SQL Server 2005

Xóa Log File trong SQL Server 2005

21/07/2011
cPanel.vn

cPanel.vn

Chia sẻ kiến thức và kinh nghiệm quản trị máy chủ, tên miền, email, hosting cũng như các thủ thuật máy tính, công nghệ thông tin.

Liên hệ quảng cáo: haomd@cpanel.vn

Follow Us

Danh mục

  • Control Panel
  • cPanel/WHM
  • Direct Admin
  • Domain/Host/Server
  • Email Server
  • HELM
  • Hosting
  • Internet
  • Kloxo-LxAdmin
  • Linux
  • LNMP
  • MSSQL
  • MySQL
  • Nhiếp ảnh
  • Plesk
  • Tên miền
  • Themes
  • Thủ thuật SEO
  • Virtuozzo
  • VMWare
  • VPS
  • Web Server
  • Windows

Thẻ

123system 123systems backup ca si ngan khanh CentOS cpanel CSF directadmin facebook google google apps google music beta green value host greenvaluehost hack tên miền how to install kenh14 kenh14.vn khuyến mãi kloxo kênh 14 kênh 14 bị hack like fanpage linux lnmp mime type mysql ngân khánh outlook phpmyadmin tên miền tên miền miễn phí vietidc vmware vmware server VPS vps giá rẻ vps miễn phí vtc vtca vtc academy windows windows xp đăng ký tên miền ưu đãi

Recent News

Khắc phục lỗi “DA appears to be using SSL. Change your script to connect to ssl” khi đổi mật khẩu Round Cube trên DirectAdmin

Khắc phục lỗi “DA appears to be using SSL. Change your script to connect to ssl” khi đổi mật khẩu Round Cube trên DirectAdmin

11/02/2022
Cấu hình Laravel trên DirectAdmin

Cấu hình Laravel trên DirectAdmin

03/11/2024
  • Giới thiệu
  • Quảng cáo
  • Dịch vụ

© 2008 - 2024 cPanel.vn - Powered by VietIDC and Raspberry Pi Việt Nam.

No Result
View All Result
  • Home
  • Control Panel
    • cPanel/WHM
    • Direct Admin
    • HELM
    • Hosting Controller
    • IspConfig
    • Kloxo-LxAdmin
    • LNMP
    • Plesk
    • Webmin
  • Domain/Host/Server
    • Hosting
    • Tên miền
    • VPS
  • Ảo hóa
    • Virtuozzo
    • VMWare
  • Hệ điều hành
    • Linux
    • Windows
  • Internet
    • Thủ thuật SEO
    • Nhiếp ảnh
  • Server
    • Web Server
    • Email Server
    • Database Server
      • MSSQL
      • MySQL
  • WordPress
    • Themes

© 2008 - 2024 cPanel.vn - Powered by VietIDC and Raspberry Pi Việt Nam.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In