Modify MySQL database password tutorial in Linux system

Source: Internet
Author: User

Where the original password is known: How to change the password (need to log in with the root user)

Go to MySQL Database

[Email protected] System name ~ "#mysql-uroot-p original password

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/86/28/wKioL1e2eKHSrisuAAAtRyFJ5Vg465.jpg-wh_500x0-wm_3 -wmp_4-s_3247851976.jpg "title=" C44.tmp.jpg "alt=" Wkiol1e2ekhsrisuaaatryfj5vg465.jpg-wh_50 "/>

Mysql>use MySQL

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/86/28/wKiom1e2ekjS4yGJAAAMyaatY8s815.jpg-wh_500x0-wm_3 -wmp_4-s_1089414597.jpg "title=" 9564.tmp.jpg "alt=" Wkiom1e2ekjs4ygjaaamyaaty8s815.jpg-wh_50 "/>

Mysql>select * from Mysql.user;

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/86/28/wKioL1e2ewqTZl-IAACU5X7mTxA662.jpg-wh_500x0-wm_3 -wmp_4-s_2921928983.jpg "title=" 968f.tmp.jpg "alt=" wkiol1e2ewqtzl-iaacu5x7mtxa662.jpg-wh_50 "/> Notes: The left column is the host name, The middle is the user name, then the password bar;

Mysql>update User Set Password=password ("New password") where user= ' root ' and host= ' localhost ';

Note: If the user inside has more than one user, user= ' username ' host= ' host name '

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/29/wKiom1e2ngKQDQKbAABIOG_Tbbc356.jpg-wh_500x0-wm_3 -wmp_4-s_992242645.jpg "title=" 2dc0.tmp.jpg "alt=" Wkiom1e2ngkqdqkbaabiog_tbbc356.jpg-wh_50 "/>

Note: The location of the red box is the local database password; the blue box is the root user password

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/86/29/wKiom1e2nL-jnk1tAAAMWWtMuHs725.jpg-wh_500x0-wm_3 -wmp_4-s_2429279155.jpg "title=" DDF7.tmp.jpg "alt=" Wkiom1e2nl-jnk1taaamwwtmuhs725.jpg-wh_50 "/>

Note: The red box indicates that a password has been changed;

mysql> flush Privileges;

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/86/29/wKioL1e2nSXjx_xtAAAFo88Rm_s317.jpg-wh_500x0-wm_3 -wmp_4-s_2256230391.jpg "title=" DBD7.tmp.jpg "alt=" Wkiol1e2nsxjx_xtaaafo88rm_s317.jpg-wh_50 "/>

mysql>exit;

[Email protected] System name ~ "#service mysql restart Note: Restart MySQL service

Re-login to the database, the new password will be used;

This article from "10993070" blog, declined reprint!

Modify MySQL database password tutorial in Linux system

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.