当前位置:   article > 正文

linux版MySQL安装(详细教程)_linux安装mysql

linux安装mysql

linux版MySQL安装(详细教程)

期待您的关注

安装大神带你安装linux版MySQL

目录

linux版MySQL安装(详细教程)

1.linux版MySQL安装

①下载yum Repository

②安装yum Repository

③安装mysql5.7

2.MySQL的设置与配置

1)启动MySQL

①开机自启动

②启动mysql

③查看状态

2)修改密码

①获取临时密码

②登录MySQL

③关闭密码复杂验证

④设置新密码

3)修改权限:方便远程操作

4)卸载yum Repository

3.linux版MySQL的重新安装

1)卸载mysql 删除依赖包

2)清理文件

3)重复上面的1 2步骤


1.linux版MySQL安装

①下载yum Repository

wget -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

45d06a9bbf364eb1ade9c5fcb0603810.png

②安装yum Repository

yum -y install mysql57-community-release-el7-10.noarch.rpm

dc995ac50d414b53b56e2c9583e53e9c.png


③安装mysql5.7

yum -y --nogpgcheck install mysql-community-server

9217ba362bd448e9b97df5e3bc684797.png

2.MySQL的设置与配置

1)启动MySQL

①开机自启动

systemctl enable mysqld.service

②启动mysql

systemctl start mysqld.service

③查看状态

systemctl status mysqld.service      等到代码前的指示灯变绿色即已经启动

2ae7c40fc47a4788be7b17898bccc55d.png

2)修改密码

①获取临时密码

grep "password" /var/log/mysqld.log

a9eec31ab37143d68b50f4b1008375c7.png

lKvikD4CyP-_

②登录MySQL

8623e682b1b64af98834570a5db1d7ea.png

③关闭密码复杂验证

  1. set global validate_password_policy=0;
  2. set global validate_password_length=1;

ef84cd21c6cf4b35a353673d74e54656.png

④设置新密码

alter user user() identified by "123456";

c7924a3c169941f88f2cefc1f5553cfa.png

3)修改权限:方便远程操作

  1. use mysql;
  2. select host,user,authentication_string from user; --查看权限
  3. GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; --修改权限
  4. flush privileges; --刷新权限
  5. select host,user,authentication_string from user; --查看权限

b6a5a6aa19d34eceae10bea8823915f4.png

4)卸载yum Repository

因为安装了yum Repository 以后每次yum操作都会自动更新 所以需要卸载掉

yum -y remove mysql57-community-release-el7-10.noarch

ea0d04f4c05843e688be3691361aafff.png

3.linux版MySQL的重新安装

1)卸载mysql 删除依赖包

  1. rpm -qa |grep -i mysql
  2. yum remove mysql-community mysql-community-server mysql-community-libs mysql-community-common

2)清理文件

  1. find / -name mysql
  2. rm -rf 文件名

3)重复上面的1 2步骤

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/785944
推荐阅读
相关标签
  

闽ICP备14008679号