In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Xiaobian to share with you CentOS7.x uninstall and install MySQL 5.7 method, I hope you have some harvest after reading this article, let us discuss it together!
Uninstalling MySQL 5.7
1.1yum way to check if yum has mysql installed
cd
yum list installed mysql*
If or shows a list, it means MySQL is in the system.
As shown above, I have installed mysql, a total of 4 items
1.2yum Uninstall mysql
Unload all names that appear in the list
yum remove mysql-community-*
rm -rf /var/lib/mysql Remove mysql lib
rm /etc/my.cnf Delete configuration file my.cnf
You can use the wildcard * to represent all
A confirmation dialog will pop up midway. Select y.
1.3 Delete other related documents
Delete related profiles
After unloading is complete, use View again
yum list installed mysql*
At this time, no relevant files were found, indicating successful uninstall.
Check out the remaining files,
whereis mysql
/usr/share/mysql was not deleted. Continue deleting the file.
View other configurations
systemctl list-unit-files | grep mysql
Install MySQL 5.7
1. Download Mysql file
Domestic Mysql 5.7 mirror address
http://mirrors.163.com/mysql/Downloads/MySQL-5.7/
I chose 5.7.26-1.el7.
2. Install mysql
After unzipping it, I put it in the/OPT/MySQL folder
To install mysql-server service, you only need to install the following 5 software packages, use rpm -ivh to install (install in order, the latter services depend on the previous services)
If an error is reported during the installation of clinet, the following is true:
Cause: This is due to yum installing older versions of GPG keys
Solution: add--force --nodeps after
3, check whether the installation is successful
#mysql --version
As shown above, 5.7.26 was successfully installed.
Initialize and generate initial random password
# mysqld --initialize #Initialize to generate random password at/var/log/mysqld.log
The requested URL/var/log/log.js was not found on this server.
In the last line, you can see the default root random password, which will be used when logging in later.
5. Modify the users and their groups in the mysql database directory, and then start the mysql database.
If you do not modify the group attributes, mysql will not start, and an error will be reported.
6. Set the boot to start automatically
systemctl enable mysqld.service
7. Enter MySQL database
The password used here is the initial password generated during initialization
8. Change the root password
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
9. modify access
Purpose: any host connects to mysql server via user root and password 123456
10, modify character set
Since we are a Chinese system, and MYSQL default character is latin1, so it is easy to appear garbled, so we need to modify the encoding method of the character set
After entering MySQL, you will find
show variables like '%char%';
The encoding method of the current character set is as follows. In order to avoid garbled characters, it is necessary to modify the character set statistics to utf8.
Enter the/etc/my.cnf file
Add these items
[client]default-character-set=utf8[mysql]default-character-set=utf8[mysqld]character_set_server = utf8collation_server = utf8_general_ci
Note the difference between_and_.
After restarting MySQL service, enter MySQL to view the code as follows
Note here that the modified character set only takes effect on the later database, and the existing database is invalid, so it is recommended to modify the encoding method as soon as possible after installing MYSQL.
RPM default path when installing MySql
Data file: /var/lib/mysql/
Configuration file template: /usr/share/mysql mysql
Client Tools Directory: /usr/bin
Log directory: /var/log/pid
sock file: in/var/lib/mysql/directory
General configuration files are placed under/etc
After reading this article, I believe you have a certain understanding of "CentOS7.x uninstall and install MySQL 5.7 method", if you want to know more related knowledge, welcome to pay attention to 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.