Linux forgot the root password of the original MYQL

Source: Internet
Author: User
Tags safe mode

Forget the root password of the original MYQL

# /etc/init.d/mysqld Stop
# Mysqld_safe--skip-grant-tables &
&, which means running in the background, no longer running in the background, then open a terminal.
# MySQL
mysql> use mysql;
mysql> UPDATE user SET password=password("test123") WHERE User = 'root';
Mysql> flush Privileges;
Mysql> exit;

Password changes, restart the service with a new password login can be.

# /etc/init.d/mysqld Restart


Note: I still can not log on after the password, always prompt:

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)


Safe Mode Login Mysql,select * from user; The value of host is ' 127.0.0.1 ', as long as the value of host is changed to '% '.



Linux forgot the root password of the original MYQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.