当前位置:网站首页>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.tarInstall 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.rpmAlso 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.logA temporary password is generated for [email protected]: xxxxxx
(xxxxxxThis is the initial password 进入mysql复制即可)
登录MySQL修改初始化密码
mysql -uroot -pIt 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 requirementsIf 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.serviceAfter closing or releasing the port number, it is found that the remote access is successful

至此centos下mysqlThe installation is completed perfectly
边栏推荐
- JS 函数 this上下文 运行时点语法 圆括号 数组 IIFE 定时器 延时器 self.备份上下文 call apply
- CorelDRAW2022精简亚太新增功能详细介绍
- 10. Redis implements likes (Set) and obtains the total number of likes
- LeetCode Daily Question 2022/7/25-2022/7/31
- First acquaintance with C language -- array
- 7. List of private messages
- 知识蒸馏7:知识蒸馏代码详解
- 【Android】Room —— SQLite的替代品
- Static routing + PAT + static NAT (explanation + experiment)
- 【CV项目调试】CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT问题
猜你喜欢

Manchester City confuses fans with smart scarf that detects emotions

4. Sensitive word filtering (prefix tree)

MPPT太阳能充放电控制器数据采集-通过网关采集电池电压容量电量SOC,wifi传输

Observer mode (1)

YOLOV5 study notes (3) - detailed explanation of network module

10. Redis implements likes (Set) and obtains the total number of likes

There is a problem with the multiplayer-hlap package and the solution cannot be upgraded

软件积累 -- 截图软件ScreenToGif

Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care

Software accumulation -- Screenshot software ScreenToGif
随机推荐
图解lower_bound&upper_bound
YOLOV5 study notes (2) - environment installation + operation + training
BAT can't sell "Medical Cloud": Hospitals flee, mountains stand, and there are rules
Project (5) - Small target detection tph-yolov5
自动化办公案例:如何自动生成期数据?
15. Website Statistics
图像处理技术的心酸史
多线程下类对象的服务承诺探讨
golang GUI for nuxui — HelloWorld
12 磁盘相关命令
Uninstallation of mysql5.7.37 under CentOS7 [perfect solution]
【HCIP】ISIS
Chapter 9 SVM实践
Basic learning about Redis related content
Classic linked list OJ strong training problem - fast and slow double pointer efficient solution
[1154] How to convert string to datetime
The Sad History of Image Processing Technology
execsnoop 工具
Moxa NPort 设备缺陷可能使关键基础设施遭受破坏性攻击
YOLOV5学习笔记(二)——环境安装+运行+训练