1. Go to the location where you want to store the installation package 2. Check whether the MySQL service has been installed in the system. There are two ways: rpm -qa | grep mysql yum list installed | grep mysql 3. If already installed, remove MySQL and its dependent packages: 4. Download the YUM source of mysql57-community-release-el7-8.noarch.rpm: wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm 5. Install mysql57-community-release-el7-8.noarch.rpm: After installation, you will get the following two packages: mysql-community.repo mysql-community-source.repo 6. Install MySQL. If prompted, press Y all the way to the end After the installation is complete, run mysql, and a random password will be automatically generated in the service mysqld start grep "password" /var/log/mysqld.log The following content will be returned. The string at the end is the password. Copy it: A temporary password is generated for root@localhost: hilX0U!9i3_6 7. Log in to the MySQL server and update the password for user root: Note: Since MySQL 5.7 uses the password strength verification plug-in validate_password, we need to set a password with a certain strength; mysql -u root -p hilX0U!9i3_6 Then change your password SET PASSWORD = PASSWORD('your new password'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; flush privileges; Set user root to be accessible from any IP: grant all privileges on *.* to root@"%" identified by "new password"; Set user root to be accessible locally: grant all privileges on *.* to root@"localhost" identified by "new password"; Refresh permissions to make them effective: OK, enter exit and log in again with the new password! Note: If you still cannot connect using the remote tool, try using the iptables -F command to clear the rules in the firewall chain. 8.MySQL control commands: start, stop, restart, check status service mysqld start service mysqld stop service mysqld restart service mysqld status systemctl start mysqld service mysqld stop service mysqld restart systemctl status mysqld 9. Set MySQL character set to UTF-8: Open the my.cnf file in the /etc directory (this file is the main configuration file of MySQL): Add the following code before [mysqld]: Add the following code after [mysqld]: Log in to mysql again and check the character set. If 6 utf8 characters are OK, 10. Check the character set of the specified data table in the specified database, such as checking the character set of the servers table in the MySQL database: View the character sets of all columns of a specified table in a specified database, such as viewing the character sets of all columns of the servers table in the MySQL database: 11. If you forget your password, you can reset it as follows: service mysqld stop mysqld_safe --user=root --skip-grant-tables --skip-networking & mysql -u root After entering MySQL use mysql; update user set password=password("new_password") where user="root"; flush privileges; 12. Storage directory of some files Configuration Files Directory where database files are stored Logging Files Service startup script Socket file 13.MySQL uses the TCP/IP protocol to transmit data. The default port number is 3306. We can view it through the following command: Summarize The above is the detailed steps for installing MySQL5.7 on CentOS7 through YUM introduced by the editor. I hope it will be helpful to everyone! You may also be interested in:
|
<<: Native JS realizes compound motion of various motions
>>: Summary of discussion on nginx cookie validity period
In daily work, we often need to view logs. For ex...
Table of contents 1. Use the warehouse to create ...
This article uses examples to describe the three ...
Preface Note: The test database version is MySQL ...
Table of contents 1. What is a transaction? 2. Th...
How to uninstall Mysql perfectly? Follow the step...
Using DOSBox, you can simulate DOS under Windows ...
Make a note so you can come back and check it lat...
Part of the code: Copy code The code is as follow...
1. Download 1. MySQL official website download ad...
Table of contents 1. Common function classificati...
Table of contents Essential Difference Database s...
This article shares the specific code of jQuery t...
Table of contents 1. Command 2. docker-compose.ym...
History of ZFS The Z File System (ZFS) was develo...