当前位置:网站首页>Install MySQL using Yum for Linux
Install MySQL using Yum for Linux
2022-07-29 00:04:00 【Goose goose goose】
List of articles
Linux And yum install MySQL
Deploy MySQL Databases can be deployed in many ways , There are three common deployment methods :yum install 、rpm Install and compile and install . Each installation method has its own advantages , So what enterprises usually adopt is rpm And binary installation .
Download address of the official website of the database
Mysql 5.7 The main characteristics of
Better performance : For multi-core CPU、 Solid state disk 、 Locks have better optimization , Per second 100W QPS It is no longer MySQL The pursuit of , Will the next version be available 200W QPS That's what our users are more concerned about
better InnoDB Storage engine
More robust replication capabilities : Replication brings a solution that does not lose data at all , Traditional financial customers can also choose to use MySQL database . Besides ,GTID Online smooth upgrades are also possible
Better optimizer : The significance of optimizer code refactoring will bring great improvements in this version and later versions ,Oracle The authorities are working on MySQL The biggest problem before
Native JSON Type of support
Better geographic information service support :InnoDB Native supports geographic location types , Support GeoJSON,GeoHash characteristic
newly added sys library
yum Deployment way
from CentOS 7.0 Since its publication ,yum Start using in the source Mariadb Instead of MySQL Installation ( What's here mariadb, and mysql What's the difference? , Interested partners can check it by themselves ). Even if you type in yum install -y mysql , It also shows Mariadb Installation content of . If you want to install Mysql Must use Mysql Official yum Source .
1、 To write yum Source configuration file
# Good configuration yum Source , Include epel Source
1. curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
2. wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
3. yum -y install vim wget
Official use yum Warehouse


wget https://dev.mysql.com/get/mysql80-community-release-el7-4.noarch.rpm( Copy the link )

yum install mysql80-community-release-el7-4.noarch.rpm
2、 Generate yum Source cache
Every time we write , All need to generate yum cache , To avoid installation errors .
1. yum makecache
3、 Check the installation yum Does the source exist
1. yum repolist enabled | grep mysql
Select the version installed by default The default is 8.0 edition
install YUM Management Kit , This package provides yum-config-manager Command tool
1. yum -y install yum-utils
2. yum-config-manager --disable mysql80-community
3. yum-config-manager --enable mysql57-community
4. yum repolist enabled | grep mysql

4、 install MySQL service
yum install -y mysql-community-server Then wait for the installation
5、 start-up MySQL service
start-up mysqld Server side
1. systemctl start mysqld
See if it starts
2. systemctl status mysqld

6、 initialization
MySQL Server initialization ( from MySQL 5.7 Start )
stay MySQL When the server starts initially , If the server's data directory is empty , Then the following will happen :
MySQL The server is initialized .
Generate... In the data directory SSL Certificate and key files .
Install and enable the validate_password plug-in unit .
Will create a super user account ’root’@‘localhost’. And will set the password of the super user , Store it in the error log file /var/log/mysqld.log in .
- grep ‘temporary password’ /var/log/mysqld.log

7、 Default password and try to change it
mysql -uroot -p'goUaahghs8?r'

# The reason for the following error is that the initialization password needs to be changed
1. show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
2. alter user [email protected] identified by '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
# Too simple a password will fail , Because it does not meet the requirements of password complexity
# Change Password
1. alter user [email protected] identified by '[email protected]';
Query OK, 0 rows affected (0.00 sec)
# Refresh the permissions
2. FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
# To set a simpler password, you need to cancel the password complexity , edit /etc/my.cnf The configuration file , stay [mysqld] Add the following content to the configuration block ( This configuration is not recommended for enterprise build environments )
plugin-load=validate_password.so
validate-password=OFF
8、 Remote connection
Remote login also requires authorization for remote login
Mysql Remote login is not allowed by default , We need to set off selinux Or firewall , Open without closing the firewall 3306 port ;
# Allow local users to link
1. grant all privileges on *.* to [email protected] identified by ' password ';
Query OK, 0 rows affected, 1 warning (0.00 sec)
# Allow any IP Connect
2. grant all privileges on *.* to [email protected]'%' identified by ' password ';
Query OK, 0 rows affected, 1 warning (0.00 sec)
Add open 3306 Port of iptables The rules
iptables -t filter -I INPUT -p tcp --dport 3306 -j ACCEPT
Uninstall the installed MySQL
//rpm Package installation mode uninstall
Check the package name :rpm -qa|grep -i mysql
The delete command :rpm -e –nodeps Package name
//yum Installation method download
1. View installed mysql
command :rpm -qa | grep -i mysql
2. uninstall mysql
command :yum remove mysql-community-server-5.6.36-2.el7.x86_64
see mysql Other dependencies :rpm -qa | grep -i mysql
// Unload dependencies
yum remove mysql-libs
yum remove mysql-server
yum remove perl-DBD-MySQL
yum remove mysql
Next >>>MySQL Basic database management
边栏推荐
- EN 1873屋面用装配附件.塑料单个屋面灯—CE认证
- Worthington - chemical properties and related studies of Worthington trypsin
- 数仓:Doris在美团的应用实践
- Please briefly describe the respective characteristics of list, set and map type sets (briefly describe three different inheritance methods)
- 考过HCIP入职心仪公司,分享华为认证学习经历及心得
- Websocket heartbeat mechanism (keep alive mechanism)
- VS2005 accesses the setting method "recommended collection" of vss2005 through sourceoffsite
- 通配符 SSL/TLS 证书
- Powercl batch creates and manages virtual switches
- PIP image download
猜你喜欢

Powercl batch creates and manages virtual switches

The failure rate is as high as 80%. How to correctly complete the strategic planning of digital transformation?

Leetcode59. Spiral matrix II
![[detailed and super simple] how to use websocket links](/img/bf/5068f84e0d81a8330529cc4d7d5d27.png)
[detailed and super simple] how to use websocket links

JS高级 之 ES6~ES13 新特性

ISO 13400(DoIP)标准解读

Leetcode62. Different paths

Tyrosine decarboxylase -- characteristics of tyrosine decarboxylase of Streptococcus faecalis in Worthington

EN 1935 building hardware. Single axis hinge - CE certification

Uricase - Characteristics of uricase in Worthington pig liver:
随机推荐
【MySQL系列】MySQL数据库基础
Best practices for migration of kingbasees v8.3 to v8.6 of Jincang database (2. Compatibility of kingbasees v8.3 and v8.6)
【C】逆序字符串(俩种递归思路)
Compatibility description between kingbasees and Oracle (4. SQL)
【MySQL 8】Generated Invisible Primary Keys(GIPK)
Have passed hcip and joined the company of your choice, and share the learning experience and experience of Huawei certification
Arm-a53 data "recommended collection"
What is a driver signature and how does the driver get a digital signature?
Uricase - Characteristics of uricase in Worthington pig liver:
Zibo station construction guide (aigler)
VS2005 accesses the setting method "recommended collection" of vss2005 through sourceoffsite
ZABBIX 5.0 uses its own redis template for monitoring
【TA-霜狼_may-《百人计划》】图形3.6 纹理压缩——包体瘦身术
【C】 Reverse string (two recursive ideas)
Type 1-5 components
Urease -- Characteristics and determination scheme of Worthington jack bean urease
考过HCIP入职心仪公司,分享华为认证学习经历及心得
VMware VCSA 7.0 Install
迅为IMX6开发板QT系统创建AP热点基于RTL8723-交叉编译iptables
【TA-霜狼_may-《百人计划》】美术2.2 模型基础