当前位置:网站首页>CentOS7下安装mysql5.7
CentOS7下安装mysql5.7
2022-07-28 10:12:00 【Code Hamal】
Centos7 安装和配置MySQL5.7
1、下载mysql的rpm包
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
2、安装mysql安装源
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
3、在线安装mysql
yum -y install mysql-community-server
下载的东西较多,请耐心等待
4、启动MySQL服务
systemctl start mysqld
5、设置开机启动
systemctl enable mysqld
systemctl daemon-reload
6、修改root登录密码
mysql安装完成之后,会在/var/log/mysqld.log文件中给root生成了一个临时的默认密码。
vim /var/log/mysqld.log

复制此密码,使用此密码登录root
[[email protected] ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.29 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
修改密码, mysql5.7默认密码策略要求密码必须是大小写字母数字特殊字母的组合,至少8位
ALTER USER 'root'@'localhost' IDENTIFIED BY '[email protected]';
允许远程登陆
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '[email protected]' WITH GRANT OPTION;
刷新权限
flush privileges; #刷新当前配置
7、配置防火墙
# 1> 开放3306端口(虚拟机下使用,云服务器请配置服务)
# 设置 iptables service
yum -y install iptables-services
# 如果要修改防火墙配置,如增加防火墙端口3306
vi /etc/sysconfig/iptables
# 增加规则
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT #保存退出后
# 配置防火墙:
systemctl restart iptables.service # 重启防火墙使配置生效
systemctl enable iptables.service # 设置防火墙开机启动
8、配置mysql默认编码为utf-8
修改/etc/my.cnf配置文件,在[mysqld]下添加编码配置
character_set_server=utf8
init_connect=‘SET NAMES utf8’
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-fS0DXShX-1602230947110)(.\mysql57安装\配置mysql默认编码为utf-8.png)]
9、重启mysqld
systemctl restart mysqld
ES utf8’
[外链图片转存中…(img-fS0DXShX-1602230947110)]
9、重启mysqld
systemctl restart mysqld
边栏推荐
- Performance test of API gateway APIs IX in Google cloud T2a and T2D
- Redis design specification
- Voice chat app - how to standardize the development process?
- Continue to write the greatest work based on modelarts [play with Huawei cloud]
- 记录一次idea中的父子项目修改project与module名称,亲测!
- 不登高山,不知天之高也;不临深溪,不知地之厚也
- Prometheus 运维工具 Promtool (四)TSDB 功能
- Context values traps and how to avoid or mitigate these traps in go
- 配置树莓派,过程和遇到问题
- Detailed explanation of super complete knowledge points of instruction system
猜你喜欢

Sword finger offer

【栈的应用】--- 中缀表达式转后缀表达式

Choosing a supplier service system is the first step for large health industry enterprises to move towards digital transformation

6. Double pointer -- the sum of the two numbers of the incremental array is equal to the target number

巧用ngx_lua做流量分组

Voice chat app - how to standardize the development process?

7、二分法——寻找一组重复或者有序但是旋转的数组

【微信小程序】项目实战—抽签应用

SuperMap iServer发布管理以及调用地图服务

Typora tutorial
随机推荐
谈谈基于JS实现阻止别人调试通过控制台调试网站的问题
13. Hash table - the first common node of two linked lists
14. Double pointer - the container that holds the most water
11、链表反转
Prometheus 运维工具 Promtool (四)TSDB 功能
【云驻共创】企业数字化转型,华为云咨询与你同行
ogg里用多个filter语法应该怎么写?
5. Dynamic programming -- Fibonacci series
6. Double pointer -- the sum of the two numbers of the incremental array is equal to the target number
按位与、或、异或等运算方法
语音聊天app——如何规范开发流程?
8. Numbers that appear more than half of the time in the array
Vulnerability analysis hevd-0x8.integeroverflow[win7x86]
C语言 二级指针详解及示例代码
(1) Summary of machine learning concepts
Get to know SuperMap idesktop for the first time
MySQL的SQL TRACE一例
Leetcode -- minimum number of rotation array
7. Dichotomy -- find a set of repeated or ordered but rotating arrays
3. Print the linked list in reverse order with the array