Password to modify the MySQL user (root) under Linux

Source: Internet
Author: User
Tags root access pkill

The modified users are listed as root.
first, the root of the original myql password;


Method One:
Outside the MySQL system, use the Mysqladmin
#mysqladmin-u root-p Password "test123"
Enter Password: "Enter the original password"

Method Two:
By logging into the MySQL system,
#mysql-uroot-p
Enter Password: "Enter the original password"
Mysql>Use MySQL;
Mysql>Update user Set Password=password ("test") where user= ' root ';
Mysql>flush Privileges;
Mysql>exit;



Second, forget the original myql root password;

First, you must have root access to the operating system. If you do not have the root authority of the system, consider the root system before taking the following steps.
Similar to the Safe Mode login system, it was suggested thatpkill MySQL, but I'm not suggesting that ha. Because when you execute this command, it can result in a situation like this:
/ETC/INIT.D/MYSQLD status
Mysqld dead but Subsys locked
This may not be useful even if you are starting MySQL in safe mode, so this is usually the case/etc/init.d/mysqld Stop, if you unfortunately first use the Pkill, then start a bit more stop.
#mysqld_safe--skip-grant-tables &
&amp, that 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;
# #本来mysql是不分大小写的, but this is the specific value of MySQL database that is modified in MySQL, to be noted.

   

Password to modify the MySQL user (root) under Linux

Related Article

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.