In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
It is believed that many inexperienced people have no idea about how to install mysql8 in Centos7. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
1. Configure the Mysql 8.0 installation source:
Sudo rpm-Uvh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
2. Install Mysql 8.0
Sudo yum-enablerepo=mysql80-communityinstall mysql-community-server
Y is selected below.
Isn't it easy to see that complete is installed?
3. Start the mysql service
The first thing to do after installation is of course to start the mysql service.
Sudo service mysqld start
So even if the startup is over, don't you believe it? Take a look at the running status:
Service mysqld status
Well, I'm not kidding you.
4. View the temporary root password:
After installing mysql, a temporary password is generated for root users to log in, so where can I see the temporary password?
Just enter the following command:
Grep "A temporary password" / var/log/mysqld.log
I'll go. It's complicated.
5. Change the temporary password:
It is estimated that only aliens can remember this password. as an earthling, the first thing I do is to change it so that I can easily remember the password.
Log in to mysql with a temporary password first
Enter: mysql-uroot-p
Enter the password after Enter password:, and note that you can't see it when you enter the password. Don't worry, just enter after typing.
Congratulations, this is a successful login.
First, we have to change the password:
Enter: ALTER USER 'root'@'localhost' IDENTIFIED BY' newpassword'
The new password here needs to be changed to your own password. I want to change the password to root, so I enter: ALTER USER 'root'@'localhost'IDENTIFIED BY' root'
Oh, the prompt password does not meet the password authentication policy, and the password is too simple.
Well, now there are two options:
1. Make the password a little more complicated and make it in line with the password authentication policy, which is of course the best and in line with international practice.
two。 Change the password authentication policy to a simple password, which is in line with the practice of lazy people.
Well, as an enterprising person, I'll choose 2.
Let's first take a look at the current password authentication policy.
Input: SHOW VARIABLES LIKE 'validate_password.%'
I'll go and don't let me see it until I reset the password. Look directly at the official documentation:
Validate_password.length is the minimum length of the password. The default is 8. Let's change it to 4.
Set global validate_password.length=4
Validate_password.policy verifies the complexity of the password, we change it to 0
Set global validate_password.policy=0
Validate_password.check_user_name username check, username and password can not be the same, we also remove it
Set globalvalidate_password.check_user_name=off
Now execute the command to change the password:
ALTER USER 'root'@'localhost' IDENTIFIED BY' root'
Successfully, the password is set to root, but I suggest you set a complicated password and don't be so lazy.
6. Configure remote access
Use mysql customer connection to report an error that does not allow a connection, that is because there is no permission for remote access.
Baidu basically says execution.
GRANT ALL ON *. * TO 'root'@'%'; is fine, but I can't wait to report a mistake:
Look at the default MySQL user:
Use mysql
Select host, user, authentication_string, plugin fromuser
It is found that the host of root is localhost, not%, so let's add a root account in which host is%:
CREATE USER 'root'@'%' IDENTIFIED BY' root'
Check the user again.
Select host, user, authentication_string, plugin fromuser
You can see that root users whose host is% have been added.
Then execute:
GRANT ALL ON *. * TO 'root'@'%'
It worked. Hey, hey.
Connection successful:
7.navicat connection mysql
Connecting to mysql with navicat will still result in an error:
The reason is that the encryption rules of mysql8 are different. It is caching_sha2_password.
Just change the encryption to mysql_native_password:
ALTER USER'[user name]'@% 'IDENTIFIED WITH mysql_native_password BY' [password]'
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_passwordBY' root'
Encryption method and changed to mysql_native_password:
After reading the above, have you mastered how to install mysql8 in Centos7? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.