In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Premise: mysql version 5.7 Linux version Red Hat centos7 goal: set up a MYSQL database server and set the local login password of the database administrator to 123456
-1. Installation strategy
-2. Check the installation
~ # rpm-qa | grep 'mysql' to check whether it is installed
~ # rpm-qc mysqld to view all configuration files of the service
/ etc/my.cnf
~ # cat / etc/my.cnf (various parameters defined by the configuration file will vary with different versions)
...
Datadir=/var/lib/mysql-find the default location for storing data
Log-error=/var/log/mysqld.log-find the default log
...
-3. Start the service # systemctl start mysqld
-4. Log in with the initial password (version 5.7 is stored in the log by default)
~ # grep 'password' / var/log/mysqld.log
Password is generated for root@localhost: Y2d > EdirOfVs
~ # mysql-u root-p 'y2d > EdirOfVs' remember that passwords are random
-5. Change the password (if you remember the initial password, at least it is highly secure, )
Method 1:
The mysql > set global validate_password_policy=0; policy is set to 0, which means only the password length is checked
The default password length for mysql > set global validate_password_length=6; is 6
Mysql > alter user root@ "localhost" identified by '123456; modification completed
Method 2: this method should follow policy 1 to set a new password
0/LOW: check only the length
1/MEDIUM: check length, numbers, case, special characters
2/STRONG: check length, number, case, and special character dictionary files.
~ # mysqladmin-hlocalhost-uroot-p password "New password"
Enter password: original password
-6. Forget your password? Don't worry. Look down.
~ # systemctl stop mysqld shut down the service first
~ # vim / etc/my.cnf modify configuration file
[mysqld]
Skip-grant-tables adds this line
: wq
~ # systemctl restart mysqld restart the service
-7. Log in and set a new password
~ # mysql go straight in
Mysql > update mysql.user set authentication_string=password ('654321') where user='root' and Host = 'localhost'
Mysql > flush privileges
Mysql > quit
~ # vim / etc/my.cnf exit mysql and modify the configuration file again
[mysqld]
# skip-grant-tables comment out or delete the previously modified ones
: wq
~ # systemctl restart mysqld modify configuration file remember to restart
~ # mysql-uroot-pendant 654321 'pull on ok
Mysql >
For criticism and correction, please leave a message in the comment counter, and I will modify it when I see it. HAHA
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.