Linux RPM 安装 Mysql

Linux RPM 安装 Mysql

安装环境

系统RHEL 6.8
Mysqlmysql 8.0.17

所需文件

mysql-8.0.17-1.el6.x86_64.rpm-bundle.tar
在这里插入图片描述

操作

  cd /usr/local/
  mkdir mysql

将安装包复制到此解压

  tar -xvf mysql-8.0.17-1.el6.x86_64.rpm-bundle.tar

安装community,libs,client,server

rpm -ivh mysql-community-server-8.0.17-1.el6.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-8.0.17-1.el6.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-8.0.17-1.el6.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-common-8.0.17-1.el6.x86_64.rpm --nodeps --force

查看安装情况

rpm -qa | grep mysql

在初始化数据库之前要设置是否区分大小写(Linux上mysql默认表名字段等是区分大小写的)否则以后很难改

1. cd /etc
2. vim my.cnf
3. 在[mysqld]节点下 增加 一句话
   lower_case_table_names = 1 
注:1 为不区分大小写, 0 为区分大小写 不写默认为区分大小写

数据库初始化配置

mysqld --initialize;

chown mysql:mysql /var/lib/mysql -R;

开启服务

service mysqld start;

设置启动项

systemctl  enable mysqld;

查看密码

cat /var/log/mysqld.log | grep password

登录

mysql -uroot -p

修改密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';

退出

exit

设置远程登录人

create user 'root'@'%' identified with mysql_native_password by 'root';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;

修改加密规则(可选)

ALTER USER 'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER;

更新权限

flush privileges;

退出

exit

关闭 firewall(可选)

systemctl stop firewalld.service;
systemctl disable firewalld.service;
systemctl mask firewalld.service;

完成!

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值