“Little knowledge, big challenge! This article is participating in the creative challenge of “Essentials for Programmers”.
The prerequisite is that your centos can connect to the Internet
Download and install Yum Repository
1, Download Yum Repository.
[root@localhost admin]# curl -O https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
Copy the code
Install Yum Repository.
[root@localhost admin]# yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
Copy the code
3. View the available REPO.
[root@localhost admin]# yum repolist enabled|grep "mysql.*-community.*"
Copy the code
4. Install mysql-server.
[root@localhost admin]# yum -y install mysql-community-server
Copy the code
Configure and start the service
1. Start the service
[root@localhost admin]# systemctl start mysqld
Copy the code
2. Search for the initial password.
[root@localhost admin]# grep 'temporary password' /var/log/mysqld.log
Copy the code
3. Log in and change the password.
[root@localhost admin]# mysql -u root -p
Copy the code
4, set the password (here I set the password to admin)
mysql> set password=password('admin');
Copy the code
The ERROR here is caused by the password strength is not enough. You need to provide a strong password.
mysql>set password =password('Centos.mysql./8');
Copy the code
Navicat connection test
1. The following problems occur after the connection
2. Solutions
Log in to mysql and query the allowed address for user use, as shown in the figure
use mysql;
select user,host from user;
Copy the code
3. Modify user permissions
update user set host = The '%' where user = 'root';
Copy the code
4. Check whether the user rights are changed successfully
select user,host from user where user="root";
Copy the code
Note Any IP address can be accessed after the change is successful
5, update database:
flush privileges;
Copy the code
Then exit mysql command line, Navicat connection again, show success