Set MySQL root user password and add new user's action under Windows system

Source: Internet
Author: User
Tags php software

This article is to learn about MySQL root user password settings, and how to add new users and so on. The detailed procedure is as follows.


First, set the root user password


1. After installing PHP and related software, click "Run", enter "cmd", open the Administrator console , 1:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6D/A7/wKioL1VpGFfhRTpoAADhsruho7s583.jpg "title=" Figure 1. PNG "alt=" Wkiol1vpgffhrtpoaadhsruho7s583.jpg "/>

Figure 1

2. In the console, move to the Mysql\bin directory. This is related to the PHP software you installed. I installed the XAMPP integrated software, which is shown in Path 2 of Mysql\bin:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6D/A7/wKioL1VpGUeS_7xRAAA6t_t6jlA251.jpg "title=" Figure 2. PNG "alt=" Wkiol1vpgues_7xraaa6t_t6jla251.jpg "/>

Figure 2

Therefore, I need to enter the following string in the console: "CD C:\xampp\mysql\bin", enter after completion, press ENTER, this will enter the Mysql\bin directory. The effect 3 shows:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6D/AB/wKiom1VpGIHCTJqsAADmOK-sAWA549.jpg "title=" Figure 3. PNG "alt=" Wkiom1vpgihctjqsaadmok-sawa549.jpg "/>

Figure 3

3. Next, enter "mysqladmin-u root password xxxxxx" and press ENTER to complete the root user password creation. Where, "xxxxxx" is the password you want to set, case sensitive. 4 is shown below:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6D/AB/wKiom1VpGa2Tmu9AAAEOA8Juy4U927.jpg "title=" Figure 4. PNG "alt=" Wkiom1vpga2tmu9aaaeoa8juy4u927.jpg "/>

Figure 4

4. After doing this, come to the XAMPP directory, go to the phpMyAdmin folder, find a file called "config.inc.php", find "$cfg [' Servers '] [$i] [' Password '] =' ", modify it to"$cfg [' Servers '] [$i] [' password '] = ' xxxxxx '"(xxxxx for your password just now), then save. At this point, the operation to create the root user password has been completed. The next action is to create a user (I have not set this value, as if it can be used as normal, because this file is easy to see, so we recommend that you first caution, if my setup method is not correct, please also inform. )。


Second, create a new user


1. Use the above steps to enter into the Mysql\bin directory, after entering the effect as shown in Figure 2 above.

2. Then, enter "Mysql-u root-p", click Enter, then on the next line will appear "Enter Password:" And a flash of the underscore, you need to enter the root user you set the password, 5 is shown:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6D/AC/wKiom1VpHPXjoJ4EAAEV1R5bJ5k700.jpg "title=" Figure 5. PNG "alt=" Wkiom1vphpxjoj4eaaev1r5bj5k700.jpg "/>

Figure 5

3. Enter the root user password, press ENTER, if the password is wrong, you will go back to the previous step, you need to re-enter "Mysql-u root-p" and enter the password, if the password is entered correctly, then 6:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6D/A8/wKioL1VpHy2Q9ssdAAF7qL1d-Rs976.jpg "title=" Figure 6. PNG "alt=" Wkiol1vphy2q9ssdaaf7ql1d-rs976.jpg "/>

Figure 6

4. Create a database that you want to assign to use, and then create a user with certain permissions for the database. The benefit of this is that you can ensure that only users who have created permissions can access the database and operate on the database based on the permissions you set. Enter "CREATE DATABASE xxx;" and enter to create the database, where "XXX" is the name of the database (in this instance, the landlord is using diary as the database name), the end must have a semicolon. 7 is shown below:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6D/A8/wKioL1VpIKmQk8XCAAIpUr57S8I349.jpg "title=" Figure 7. PNG "alt=" Wkiol1vpikmqk8xcaaipur57s8i349.jpg "/>

Figure 7

5. Next, create a user with certain privileges for the data. Enter as follows:

GRANT SELECT, INSERT, UPDATE, DELETE

On diary.* to

' username ' @ ' localhost '

Identified by ' UserPassword ';

Where username is the user name of the user to be created, userpassword the user's password. Enter after the return, Effect 8 (the landlord created the user name is "Hellen", the password is "Hellenpass"):

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6D/A8/wKioL1VpIsPC5lxyAADgvFCt2Gk681.jpg "title=" Figure 8. PNG "alt=" Wkiol1vpispc5lxyaadgvfct2gk681.jpg "/>

Figure 8

6. Finally, enter "FLUSH privileges;" To complete the action to create the user. At this point, Hellen users can connect to the diary database using the following code:

Mysqli_connect (' localhost ', ' hellen ', ' hellenpass ', ' Diary ');

This article is from the "sea Shiba like peak" blog, please be sure to keep this source http://winners.blog.51cto.com/7080842/1656570

Set MySQL root user password and add new user's action under Windows system

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.