linux 安装yum mysql_使用YUM在Linux(CentOS 7)下安装mysql 5.7.18的教程详解

项目需要使用MySQL,由于以前都是在windows下傻瓜式安装,基本没有遇到什么问题,但是这次是在服务器上安装,由于到Linux上安装软件不熟悉,走了不少弯路,耽误了好多时间。总结下来,以免下次再走弯路。

****************************图片插入不成功,不知道是怎么回事*********************************

一、各种环境:

linux版本:CentOS Linux release 7.2.1511 (core)

mysql版本:community sercer 5.7.18

使用的yum安装包:

Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package 25.1K

Download

(mysql57-community-release-el7-11.noarch.rpm)

二 :安装步骤

我是先在windows上下载安装包,然后通过xshell导入到服务器中。然后根据mysql官网上的步骤安装的。任何教程都没有官网上的靠谱,之前在网上搜了好多教程,每个教程的安装方法都不一样,搞得我很郁闷,而且,都没有成功。最后还是通过官网上的教程安装成功。

2.1 选择安装指南

2.2 点进入之后选择通用二进制版本。  installing MySQL on Unix/Linux Using Generic Binaries

2.3 按照上面的操作一步一步执行就可以了。

shell> yum search libaio # search for info(Mysql安装需要以来libaio库,所以需要先安装libaio库)

shell> yum install libaio # install library

shell> groupadd mysql

shell> useradd -r -g mysql -s /bin/false mysql

shell> cd /usr/local

shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz

shell> ln -s full-path-to-mysql-VERSION-OS mysql

shell> cd mysql

shell> mkdir mysql-files

shell> chmod 750 mysql-files

shell> chown -R mysql .

shell> chgrp -R mysql .

shell> bin/mysql_install_db --user=mysql # MySQL 5.7.5 (mysql5.7.5选择使用这个命令,如果你的mysql是5.7.6及以上,不需要执行这个命令)

shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up

shell> bin/mysql_ssl_rsa_setup # MySQL 5.7.6 and up

shell> chown -R root .

shell> chown -R mysql data mysql-files

shell> bin/mysqld_safe --user=mysql &

# Next command is optional

shell> cp support-files/mysql.server /etc/init.d/mysql.server

执行完以上所有步骤,安装就结束了。

2.4 安装结束后,启动mysql服务

[root@***** /]# cd ~ #这里有一个问题,不知道需要需要切换到 “~”目录,之前没有“~”,启动不成功,不确定是我sytemctl start mysqld.service命令输入错了还是别的原因。

[root@***** ~]# sytemctl start mysqld.service

查看是否启动成功

[root@***** ~]# sytemctl status mysqld.service

如果有这个标识则启动成功

2.5 获取安装时的临时密码,用以登录mysql

grep'temporary

password'/var/log/mysqld.log

2017-05-10T00:55:46.982233Z

1 [Note] A temporary password is generated for root@localhost: 5C::+lMjqi+z

红框中的是临时密码。

2.5 使用临时密码登录

[root@****** ~]# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.7.18

2.6 更改密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';

Query OK, 0 rows affected (0.00 sec)

注意:最新的mysql对安全性有很高的要求,密码必须包含特殊字符、大小写、数字,否则更改不成功,报错。

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

以上所述是小编给大家介绍的使用YUM在Linux(CentOS 7)下安装mysql 5.7.18的教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!

本文标题: 使用YUM在Linux(CentOS 7)下安装mysql 5.7.18的教程详解

本文地址: http://www.cppcns.com/shujuku/mysql/190311.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值