栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

centos8 yum方式安装mysql8

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

centos8 yum方式安装mysql8

采用yum安装,可以简化安装步骤。在没有特殊需求的情况下,该安装方式是合适的。

1.  获取官方下载地址
https://dev.mysql.com/downloads/repo/yum/

2. 下载文件
wget https://repo.mysql.com/mysql80-community-release-el8-3.noarch.rpm
3. 执行安装
# yum localinstall mysql80-community-release-el8-3.noarch.rpm
4. 查看yum源
# yum repolist enabled | grep "mysql.-community*"
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
5. 禁用centos8.0自带的mysql模块
yum module disable mysql
6. 安装mysql
yum install mysql-community-server
7. 修改默认配置
vim /etc/my.cnf

设置大小写不敏感。 如果有端口冲突,可以设置单独的端口。密码加密算法插件。

相关参数配置项根据需要添加。

#让MYSQL大小写敏感(1-不敏感,0-敏感)
lower_case_table_names=1

port=13306

default_authentication_plugin=mysql_native_password
8. 启动mysql服务
systemctl start mysqld

查看mysql服务启动状态

systemctl status mysqld
9.  查看mysql安装时生成的随机密码
grep ‘temporary password’ /var/log/mysqld.log
10. 登录mysql
mysql -uroot -p

输入临时密码。

11. 修改登录密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
12. 开放mysql远程访问
# 创建权限记录:
mysql> CREATE user 'root'@'%' IDENTIFIED BY '您的密码';

# 授权:
mysql> GRANT ALL PRIVILEGES ON . TO 'root' @'%' WITH GRANT OPTION;

# 修改密码过期策略:
mysql> ALTER USER 'root' @'localhost' IDENTIFIED BY '您的密码' PASSWORD EXPIRE NEVER;

# 重新修改密码:
mysql> ALTER USER 'root' @'%' IDENTIFIED WITH mysql_native_password BY '您的密码';

# 刷新权限:
mysql> FLUSH PRIVILEGES;
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/835557.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号