当前位置:网站首页>centos安装mysql5.7
centos安装mysql5.7
2022-06-11 11:43:00 【java-zh】
注意事项
- 本次使用的是
CentOS7+MySQL 5.7.32其他版本的 5.7 MySQL 应该也支持 - 本次不提供安装包,但提供安装包的下载地址,均为官网下载地址
- 如果报出权限不足的异常请在涉及到的命令前面加上
sudo,如果无法解决请联系系统管理员分配权限
安装步骤
去官网下载rpm包,使用命令(最好一个一个分开来下载,速度会更快)
wget \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-client-5.7.32-1.el7.x86_64.rpm \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-common-5.7.32-1.el7.x86_64.rpm \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-libs-5.7.32-1.el7.x86_64.rpm \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-libs-compat-5.7.32-1.el7.x86_64.rpm \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-server-5.7.32-1.el7.x86_64.rpm为了方便,来下载页面描述一下我们下载了那些 rpm

把他们下载到 CentOS 的
/usr/mysql目录下,如图显示

然后安装这些安装包,注意有依赖,需要联网
yum install -y mysql-community-*-5.7.32-1.el7.x86_64.rpm
看到这个画面表示安装成功
4.开启服务器并初始化密码,使用的命令和命令详解:
# 开启MySQL服务器
systemctl start mysqld
# 查看默认生成的密码
cat /var/log/mysqld.log | grep password
生成的密码如下:

使用该密码登录本地 MySQL 服务器,使用命令:
mysql -uroot -p然后输入以下命令修改默认密码:
# 设置密码等级
set global validate_password_length=4;
set global validate_password_policy=0;
# 修改默认密码,注意替换后面的密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '您的密码';
我们退出后发现密码已经设置完成
5.设置 root 账户远程登陆(此步骤如果不需要可以跳过),进入到 MySQL 命令行使用命令:
use mysql;
# 注意将密码替换掉
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '您的密码' WITH GRANT OPTION;
FLUSH PRIVILEGES;
执行 show variables like 'character%'; 命令查看字符集,看到一些字符集默认还是拉丁文,我们需要将他们改成 UTF-8:

退出去以后,我们修改 /etc/my.cnf 文件来修改这个配置,使用命令:
vim /etc/my.cnf
重点修改的内容
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
使用命令 systemctl restart mysqld 重启MySQL服务就可以了。
边栏推荐
- Memory mapping image of the grayloc module in the surfacefinder process
- Use cache to reduce network requests
- Let WordPress support registered users to upload custom avatars
- [JUC supplementary] immutable object, shared meta mode, final principle
- How should ordinary people choose annuity insurance products?
- 中级web开发工程师,面试题+笔记+项目实战
- Notes on brushing questions (13) -- binary tree: traversal of the first, middle and last order (review)
- 实用WordPress插件收集(更新中)
- JS interview questions - arrow function, find and filter some and every
- my. Binlog startup failure caused by the difference between [mysql] and [mysqld] in CNF
猜你喜欢

Qt中radioButton使用

JS to realize the rotation chart (riding light). Pictures can be switched left and right. Moving the mouse will stop the rotation

Intermediate web development engineer, interview questions + Notes + project practice
![[file upload vulnerability 05] server suffix detection and bypass experiment (based on upload-labs-3 shooting range)](/img/f5/52bc5e01bb0607b6ecab828fb70c93.jpg)
[file upload vulnerability 05] server suffix detection and bypass experiment (based on upload-labs-3 shooting range)

Node连接MySql数据库写模糊查询接口

Notes on brushing questions (13) -- binary tree: traversal of the first, middle and last order (review)

Uncaught typeerror: cannot set property 'next' of undefined

Intl.NumberFormat 设置数字格式

Iframe value transfer

Maximum water container
随机推荐
AGCO AI frontier promotion (6.11)
01_ Description object_ Class diagram
WordPress数据库缓存插件:DB Cache Reloaded
统计出现次数最多的前K个字符串
Elk - x-pack set user password
浙大联合微软亚研院发布视频识别新方法,可对视频逐帧识别且无需,数据标记,或可用于手语翻译等
解决swagger文档接口404的问题
The no category parents plug-in helps you remove the category prefix from the category link
Full Permutation (recursion, backtracking)
[go] interpretation of gin source code
How should ordinary people choose annuity insurance products?
js面试题---箭头函数,find和filter some和every
《公司理财师专业能力》笔记
在畢設中學習03
Let WordPress support registered users to upload custom avatars
Memory mapping image of the grayloc module in the surfacefinder process
Intermediate web development engineer, interview questions + Notes + project practice
arguments.callee 实现函数递归调用
Typescript compilation options and configuration files
实用WordPress插件收集(更新中)
