发布于 2017-10-13 10:23:58 | 164 次阅读 | 评论: 0 | 来源: 网友投递

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

Mysql关系型数据库管理系统

MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。


这篇文章主要介绍了Centos7 下Mysql5.7.19安装教程详解,小编认为非常不错,特此分享到PHPERZ平台,需要的朋友参考下吧

1、下载

从官网下载mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz,版本为5.7.19

下载地址:

https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-linux-glibc2.12-x86_64.tar.gzLinux

2、创建mysql用户组及用户

l  创建mysql用户组


#groupadd mysql

l  在mysql用户组下创建mysql用户


#useradd mysql -g mysql

3、确定安装目录和数据目录

我的mysql安装目录为/data/mysql,数据目录为/data/mysql/data。

4、上传安装文件到服务器

mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz文件通过ftp工具放到/data/installfiles目录.

5、解压tar.gz文件/data目录


#cd /data/installfiles
#tar -xvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz

6、修改目录名

将mysql-5.7.19-linux-glibc2.12-x86_64更名为mysql并移动到 /usr/local/mysql下。


#mv mysql-5.7.19-linux-glibc2.12-x86_64 /data/mysql 

7、创建存放数据目录

在/data /mysql下创建data目录


#mkdir /data/mysql/data

8、对mysql用户进行授权

 将mysql目录及下面的文件、子目录文件主改成mysql


#cd /data
#chown -R mysql:mysql mysql/

给与mysql目录及下面的文件、子目录755权限


#chmod -R 755 mysql/ 

9、编译安装并初始化mysql,并记住临时密码


#/data/mysql/bin/mysqld --initialize --user=mysql --datadir=/data/mysql/data --basedir=/data/mysql

当时安装的临时密码为:root@localhost:3?2YBeSg:Nte 

10、创建日志文件目录


mkdir -p /data/mysql/log/mariadb/
cd /data/mysql/log/mariadb/
touch mariadb.log
chmod -R 775 mariadb.log
chown -R mysql:mysql mariadb.log
chown -R mysql:mysql /data/mysql

11、启动mysql服务


/data/mysql/support-files/mysql.server start

12、登录msyql,输入密码(密码为第9步骤的初始化密码)


#mysql -u root -p

13、 修改密码为“123456”


msql>alter user 'root'@'localhost' identified by '123456';
mysql>use mysql;
msyql>update user set user.Host='%' where user.User='root';
mysql>flush privileges;
mysql>quit

14、修改/etc/my.cnf文件


# instructions in http://fedoraproject.org/wiki/Systemd
socket=/tmp/mysql.sock
[mysqld]
datadir=/data/mysql/data
socket=/tmp/mysql.sock
max_connections=1000
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/data/mysql/log/mariadb/mariadb.log
pid-file=/data/mysql/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

修改标红部分内容。

总结

以上所述是小编给大家介绍的Centos7 下Mysql5.7.19安装教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对PHPERZ网站的支持!



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

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