Application Technology: rhel as sets the initial MySQL root Password

Source: Internet
Author: User

1. We installed the MySQL database by default when installing the rhel as system. In this installation method, the initial password of the root account of the database is null.

Because some customers do not have strong security awareness, they directly enable the database after receiving the system, leaving security risks.

Therefore, the technical department must set the initial password of the MySQL database after installing the rhel as system.

The method is as follows:

After the system is installed, log on to the system, use the SETUP program, modify the default service items of the system, enable the mysqld service, and restart the server.

Or/etc/init. d/mysqld start to temporarily enable the mysql service.

Enter the command:/usr/bin/mysqladmin-u root-p password ****** (the new password is displayed in plaintext, requires the same setting rules as the system logon password). After you press enter, you will be prompted to enter the original password. Because the initial password is blank, you can press enter directly.

Verification:

1. Enter mysql-u root-p in any path and press enter to enter the password. Enter the new password and enter the Database Manager.

Use exit or quit to exit the database management program from the system.

2. Modify the config. inc. php file.

3. In the Mysql environment, you can use the following statement to set the password: (not tested)

A. insert into user (host, user, password) values ('%', 'user _ name', password ("your password ");

B. set password for user_name = password ("your password ")

The above two methods must be used to reload the authorization table.

C. Of course, you can set a password when creating a user. The grant statement will automatically encrypt the password for you.

For example

Grant all on *. * to user_name @ % identified by "your password ";

In addition, you can use the mysqladmin program in the shell environment to set the password.

For example

Mysqladmin-u root password "your password"

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.