Check whether mysql is installed
rpm -qa | grep mysql
Copy the code
Delete it if you have it
Download MySQL yum source
wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
Copy the code
Yum installation source
yum localinstall mysql80-community-release-el7-1.noarch.rpm
Copy the code
Update the yum source
yum clean all
yum makecache
Copy the code
Create a Mysql account
groupadd mysql
Copy the code
Groupadd: group ‘mysql’ already exists solution: groupdel mysql
Groupdel: cannot remove the primary group of user ‘mysql’
Solutions:
sudo vipw
Copy the code
sudo vipw -s
Copy the code
Readonly option is set (add! Do you have permission to modify the file? If you have root permission, you can :wq!
For details
After that, you can run the following commands
groupdel mysql
groupadd mysql
useradd -g mysql mysql
Copy the code
MySQL > install MySQL
yum install mysql-community-server
Copy the code
Start the MySQL
systemctl start mysqld
Copy the code
View the initial password
cat /var/log/mysqld.log | grep password
Copy the code
Log on to the MySQL
mysql -u root -p
Copy the code
Example Change the initial password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourpassword';
Copy the code
The password must contain uppercase and lowercase letters, digits, and symbols, for example, Aa-123456789
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
Allow any host to access the database
update user set host = "%" where user = "root";
GRANT ALL PRIVILEGES ON *.* TO 'root'@The '%'WITH GRANT OPTION;
Copy the code
Refresh the permissions
FLUSH PRIVILEGES;
Copy the code
This is encountered with a local SQLYog connection (probably too late)
For details
Navicat download can be connected normally
In this paper, the reference