In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "the steps for CentOS7 to install MySQL5.7 through YUM". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the steps for CentOS7 to install MySQL5.7 through YUM.
CentOS7 installs MySQL5.7 through YUM
1. Go to the location where you want to store the installation package
Cd / home/lnmp
two。 There are two ways to check to see if the MySQL service is installed on the system:
Rpm-qa | grep mysqlyum list installed | grep mysql
3. If installed, remove MySQL and its dependent packages:
Yum-y remove mysql-libs.x86_64
4. Download the YUM source for 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:
Rpm-ivh mysql57-community-release-el7-8.noarch.rpm
After installation, you get the following two packages:
Mysql-community.repo
Mysql-community-source.repo
6. If prompted to install MySQL, go all the way to the end.
Yum install mysql-server
After installation, start mysql
Systemctl start mysqld
Then a random password is automatically generated in the / var/log/mysqld.log file. We need to get this random password first to log in to the MySQL server:
Cat / var/log/mysqld.log | grep password
The following will be returned, and the end string is the password. Copy it down:
A temporary password is generated for root@localhost: hilX0U!9i3_6
7. Log in to the MySQL server and update the password of user root:
Note: since MySQL5.7 uses the password strength verification plug-in validate_password, we need to set a password with a certain strength.
Mysql-u root-Phillips X0 Utility 9i3mm 6
Then change the password
Mysql > alter user 'root'@'localhost' identified by' HellomysqlxxxxHellomysqlxxxxxxxxxxxxxxHellomysqlxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx of alter user 'root'@'localhost' identified by' Hellomysqlxxxxxxxxxxxxxxxx of Hellomysqlxxx), 0 rows affected (0.00 sec) mysql > ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;Query OK, 0 rows affected (0.00 sec)
Set the user root to be accessed under any IP:
Grant all privileges on *. * to root@ "%" identified by "new password"
Set the user root to be accessed locally:
Grant all privileges on *. * to root@ "localhost" identified by "new password"
Refresh permissions to take effect:
Flush privileges
OK, enter exit and log in again with your new password.
Note: if you still can't connect with the remote tool, try the iptables-F command to clear the rules in the chain in the firewall
8.MySQL control commands: start, stop, restart, view status
Service mysqld startservice mysqld stopservice mysqld restartservice mysqld statussystemctl start mysqldservice mysqld stopservice mysqld restartsystemctl status mysqld
9. Set the character set of MySQL to UTF-8:
Open the my.cnf file in the / etc directory (this file is the main configuration file for MySQL):
Vim / etc/my.cnf
Add the following code before [mysqld]:
[client] default-character-set=utf8
Add the following code after [mysqld]:
Character_set_server=utf8
Restart mysql and log in again. Check the character set. 6 utf8 is OK.
Show variables like'% character%'
10. View the character set of the specified data table in the specified database, such as the character set of the servers table in the mysql database:
Show table status from mysql like'% servers%'
View the character set of all columns of the specified table in the specified database, such as the character set of all columns of the servers table in the mysql database:
Show full columns from servers
11. When you forget your password, you can reset it in the following ways:
Service mysqld stopmysqld_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
twelve。 The directory where some files are stored.
Configuration file
Vim / etc/my.cnf
The directory where the database files are stored
Cd / var/lib/mysql
Logging file
Vim / var/log/ mysqld.log
Service startup script
/ usr/lib/systemd/system/mysqld.service
Socket file
/ var/run/mysqld/mysqld.pid
13.MySQL uses TCP/IP protocol to transfer data. The default port number is 3306, which can be viewed by the following command:
Netstat-anp so far, I believe you have a deeper understanding of the "steps for CentOS7 to install MySQL5.7 through YUM". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.