MySQL Learning-----(2)

Source: Internet
Author: User

---restore content starts---

0x01

The order in which the configuration files are read when MySQL starts

Default options is read from the following files in the given order:
/ETC/MYSQL/MY.CNF/ETC/MY.CNF ~/.my.cnf

How to use the configuration file
1. It looks for multiple files to look up in turn, and the result is all file intersections
2. If a parameter appears multiple times in more than one file, the final configuration will take effect

You can use MySQL--help--verbose to view
1. Displays the options that are available when the MySQL program starts, usually with a long option
2. Display the service variables available in the MYSQLD configuration file
MySQL > Show global variables
MySQL > Show Session variables

0x02

1. After the MySQL database is installed, the first initialization is to delete the anonymous user

What anonymous users are queried

Select Host,user,password from Mysql.user;

Delete the corresponding anonymous user, the actual situation, can be deleted according to the actual situation.

Drop user ' @ ' localhost ';

Drop user ' @ ' stuphp.hping3.com ';

User name account consists of two parts: [email protected]
The host can also use a wildcard character
%: Any character of any length
_: Match any single word

2. Set the password for all root users

The first way to change the password:

Instance---> MySQL > Set password for [email protected] = password (' photon ');

Format---> mysql > Set password for [email protected] = password (' Your_password ')

The second way to change the password:

The way to modify the password is to directly modify the user table under MySQL, all to be advanced to the user table to execute

so use MySQL;

Update user Set Password = password (' redhat ') where user = ' root ';

Let it take effect immediately----notify mysqld to re-read the user table

Flush privileges;

The third method modifies the password:

Example---->

Mysqladmin-uroot-hlocalhost password ' photon '-p----localhost is a host IP

Mysqladmin-u root-h localhost-p flush-privileges----Let it take effect

Format---->

Mysqladmin-u username-h hot password ' new_password '-p
Mysqladmin-u username-h host-p flush-privileges

MySQL Learning-----(2)

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.