当前位置:网站首页>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
边栏推荐
- 【CV项目调试】CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT问题
- The application of AI in the whole process of medical imaging equipment
- mmdetection trains a model related command
- Layer 2 broadcast storm (cause + judgment + solution)
- try-catch中含return
- 10. Redis implements likes (Set) and obtains the total number of likes
- Drools Rule Properties, Advanced Syntax
- Uninstallation of mysql5.7.37 under CentOS7 [perfect solution]
- JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
- Brute Force/Adjacency List Breadth First Directed Weighted Graph Undirected Weighted Graph
猜你喜欢
User interaction + formatted output
Maximum area of solar panel od js
8. Unified exception handling (controller notifies @ControllerAdvice global configuration class, @ExceptionHandler handles exceptions uniformly)
局域网电脑硬件信息收集工具
Observer mode (1)
There is a problem with the multiplayer-hlap package and the solution cannot be upgraded
图解lower_bound&upper_bound
Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care
LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING
MPPT太阳能充放电控制器数据采集-通过网关采集电池电压容量电量SOC,wifi传输
随机推荐
[1154] How to convert string to datetime
19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing
JetPack component Databinding
What level of software testing does it take to get a 9K job?
图像处理技术的心酸史
公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
Validate XML documents
Introduction and use of Drools WorkBench
How to do a startup CTO?
There is a problem with the multiplayer-hlap package and the solution cannot be upgraded
221. Largest Square
分布式与集群是什么 ? 区别是什么?
Software accumulation -- Screenshot software ScreenToGif
编译Hudi
LeetCode 1161 最大层内元素和[BFS 二叉树] HERODING的LeetCode之路
Brute Force/Adjacency Matrix Breadth First Directed Weighted Graph Undirected Weighted Graph
【银行系列第一期】中国人民银行
10、Redis实现点赞(Set)和获取总点赞数
Draw Your Cards
AtCoder Beginner Contest 261 Partial Solution