当前位置:网站首页>Installation of mysql5.7.37 under CentOS7 [perfect solution]
Installation of mysql5.7.37 under CentOS7 [perfect solution]
2022-07-31 02:46:00 【fascinated*】
不在CentOS安装mysql8.0The reason is for some middleware incompatibility 比如mycat Unexpected things will happenbug 比如mycat连接mysqlThe status is that the connection is successful,But it can't get into the database A database freeze occurs 报1184错误的现象 So I hope everyone learns virtual machine time mysqlIt is recommended to install itmysql5.7的 myself frommysql8.0.28回退到mysql5.7.37 Various errors in between 太痛苦了 So here it ismysqlinstallation and uninstallation tutorials It is convenient for everyone to follow up
centos下mysql安装步骤
进入官网MySQL :: Download MySQL Community Server (Archived Versions)
选择Red Hat Linux 7 与 centos7是一样的 互相兼容
Select the version and corresponding system 下载第一个包 mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
Check to see if the system comes with itmariadb和mysql
[[email protected] ~]# rpm -qa |grep mysql
[[email protected] ~]# rpm -qa |grep postfix
[[email protected] ~]# rpm -qa |grep mariadb
卸载命令
rpm -e --nodeps xxx
安装需要的依赖文件
yum -y install libaio
yum -y install net-tools
yum -y install perl
安装mysql5.7.37
最好将mysqlA series of files are grouped into a folder Then unzip in this directory
tar -xvf mysql-5.7.37-1.el7.x86_64.rpm-bundle.tar
Install the following files in order 必须按照顺序安装
rpm -ivh mysql-community-common-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.37-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.37-1.el7.x86_64.rpm
Also available heremysql8.0.28的安装顺序,与mysql5.7还是有点区别的
1. mysql-community-common
2. mysql-community-client-plugins
3. mysql-community-libs
4. mysql-community-client
5. mysql-community-icu-data-files
6. mysql-community-server
启动mysql
先查看mysql的状态
命令1:
service mysqld status
命令2:
systemctl status mysqld
启动mysql服务
命令1
service mysqld start
命令2
systemctl start mysqld
查看mysql进程
ps -ef | grep mysqld
设置mysql开机自启(根据自身需求 可要可不要)
systemctl enable mysqld #设置开机启动
systemctl disable mysqld #关闭开机启动
获取mysql初始化密码
MySQLThe service initialization password is automatically generated and we need to query it mysqld.log查询初始化密码
grep password /var/log/mysqld.log
A temporary password is generated for [email protected]: xxxxxx
(xxxxxxThis is the initial password 进入mysql复制即可)
登录MySQL修改初始化密码
mysql -uroot -p
It cannot be used if the initialization password has not been changedmysqlThe service will prompt you to recharge in seconds before the operation can be performed
重置密码
mysql> set password = password("123456");
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
MySQL5.7The default password policy for the version is as follows
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
+--------------------------------------+--------+
If the password setting is too simple, the system will prompt that the current policy is not satisfied 会出现以下错误
[[email protected] opt]# mysql -uroot -p
mysql> set password = password("123456");
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
If the development and test environment is too troublesome, you can use the following commands to modify the password policy
mysql> set global validate_password_policy=LOW;
mysql> set global validate_password_length=6;
Review the default password policy again
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 6 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 1 |
+--------------------------------------+-------+
7 rows in set (0.01 sec)
The simple password reset was successful again
mysql> set password = password("123456");
Query OK, 0 rows affected, 1 warning (0.00 sec)
设置mysql远程访问权限
The command to enable remote access needs to be executed on the command line
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)
客户端连接MySQL服务
默认情况下Centos防火墙是开启状态 Query the firewall status with the following command
systemctl status firewalld
方式1 关闭防火墙(Not recommended for corporate environments)
# 关闭
systemctl stop firewalld.service
# 禁用
systemctl disable firewalld
方式2 开放mysql服务端口
# Add the port number that needs to be released
firewall-cmd --add-port=端口号/tcp --zone=public --pernament
# Remove the port number that needs to be released
firewall-cmd --remove-port=端口号/tcp --zone=public --pernament
# 查看放行的端口号
firewall-cmd --list-ports
启动防火墙
# 开启
systemctl start firewalld.service
# 重启
systemctl restart firewalld.service
After closing or releasing the port number, it is found that the remote access is successful
至此centos下mysqlThe installation is completed perfectly
边栏推荐
- Software accumulation -- Screenshot software ScreenToGif
- The final exam first year course
- 19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
- 8、统一处理异常(控制器通知@ControllerAdvice全局配置类、@ExceptionHandler统一处理异常)
- Hanyuan Hi-Tech 8-channel HDMI integrated multi-service high-definition video optical transceiver 8-channel HDMI video + 8-channel two-way audio + 8-channel 485 data + 8-channel E1 + 32-channel teleph
- The use of font compression artifact font-spider
- The modification is not properly placed in the sandbox, causing Apple compatibility issues
- JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
- 16、热帖排行
- 2022牛客多校联赛第四场 题解
猜你喜欢
10、Redis实现点赞(Set)和获取总点赞数
YOLOV5学习笔记(三)——网络模块详解
编译Hudi
Word/Excel fixed table size, when filling in the content, the table does not change with the cell content
The comprehensive result of the case statement, do you know it?[Verilog Advanced Tutorial]
经典链表OJ强训题——快慢双指针高效解法
User interaction + formatted output
The Sad History of Image Processing Technology
Moxa NPort 设备缺陷可能使关键基础设施遭受破坏性攻击
JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
随机推荐
知识蒸馏7:知识蒸馏代码详解
Pythagorean tuple od js
Chapter 9 SVM实践
SQL注入 Less46(order by后的注入+rand()布尔盲注)
Moxa NPort 设备缺陷可能使关键基础设施遭受破坏性攻击
MPPT太阳能充放电控制器数据采集-通过网关采集电池电压容量电量SOC,wifi传输
Validate XML documents
Teach you how to configure Jenkins automated email notifications
SQL注入 Less47(报错注入) 和Less49(时间盲注)
6. Display comments and replies
Problems that need to be solved by the tcp framework
Brute Force/Adjacency Matrix Breadth First Directed Weighted Graph Undirected Weighted Graph
Number 16, top posts
f.grid_sample
Multilingual settings of php website (IP address distinguishes domestic and foreign)
关于 mysql8.0数据库中主键位id,使用replace插入id为0时,实际id插入后自增导致数据重复插入 的解决方法
User interaction + formatted output
STM32CUBEMX develops GD32F303 (11) ---- ADC scans multiple channels in DMA mode
try-catch中含return
15、网站统计数据