发布于 2017-05-28 22:28:52 | 129 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Mysql教程,程序狗速度看过来!

Mysql关系型数据库管理系统

MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了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的教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对PHPERZ网站的支持!



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务