Modify the root password of mysql and assign permissions.

Source: Internet
Author: User

Modify the root password of mysql and assign permissions. for example, if my Mysql is installed in the E: \ xampp \ mysql directory win7 and CMD is used, the command line uses the password-free root user to log on to the mysql database. The red font is command 1 ). UPDATE root user password to root2.) Refresh permission 3 ). allocate the root user to access the mysql database on any host. 4 ). refresh permission E: \ xampp \ mysql \ bin> mysql-uroot-pEnter password: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 41 Server version: 5.5.25a MySQL Community Server (GPL) Copyright (c) 2000,201 1, Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners. type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql> update mysql. user set password = PASSWORD ('root') where user = 'root'; Query OK, 2 rows affected (0.00 sec) Rows matched: 2 Changed: 2 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> grant all privileges on *. * to 'root' @ '%' identified by 'root' with grant option; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> \ qBye 2. use the modified root user password to log on to Mysql E: \ xampp \ mysql \ bin> mysql-uroot-pEnter password: ***** Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 42 Server version: 5.5.25a MySQL Community Server (GPL) Copyright (c) 2000,201 1, Oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners. type 'help; 'or' \ H' for help. type '\ C' to clear the current input statement. mysql> show databases; + rows + | Database | + ------------------ + | information_schema | cdcol | mysql | oms | performance_schema | phpmyadmin | test | webauth | + ------------------ + 8 rows in set (0.00 sec) mysql>

 

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.