Centos7 下Mysql5.7.19安装教程详解
作者:君之见 时间:2024-01-25 08:28:18
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 mysql3、确定安装目录和数据目录
我的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/mysql7、创建存放数据目录
在/data /mysql下创建data目录
#mkdir /data/mysql/data8、对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 start12、登录msyql,输入密码(密码为第9步骤的初始化密码)
#mysql -u root -p13、 修改密码为“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>quit14、修改/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安装教程详解网站的支持!
来源:http://blog.csdn.net/jewelry008/article/details/77964313
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
细化解析:MySQL+Webmin轻松创建数据库
scrapy数据存储在mysql数据库的两种方式(同步和异步)
![](https://img.aspxhome.com/file/2023/4/62304_0s.png)
使用Python绘制台风轨迹图的示例代码
![](https://img.aspxhome.com/file/2023/4/128214_0s.png)
改善IE6中a与a:hover的背景支持
MySQL数据库导入导出数据之报错解答实例讲解
![](https://img.aspxhome.com/file/2023/8/122878_0s.png)
MySQL 5.6 & 5.7最优配置文件模板(my.ini)
Python OS模块常用函数说明
详解pandas中iloc, loc和ix的区别和联系
python利用pandas将excel文件转换为txt文件的方法
Pycharm远程调试和MySQL数据库授权问题
![](https://img.aspxhome.com/file/2023/9/127279_0s.png)
SQL Server 数据库实用SQL语句
asp javascript值的互相传递方法
Python 实现打印单词的菱形字符图案
![](https://img.aspxhome.com/file/2023/8/93528_0s.jpg)
pycharm 创建py文件总是为txt格式的问题及解决
![](https://img.aspxhome.com/file/2023/6/97206_0s.png)
python基于爬虫+django,打造个性化API接口
![](https://img.aspxhome.com/file/2023/9/124259_0s.png)
git rebase 成功之后撤销的操作方法
![](https://img.aspxhome.com/file/2023/5/123735_0s.jpg)
django的ORM模型的实现原理
Django打印出在数据库中执行的语句问题
python中的property及属性与特性之间的优先权
![](https://img.aspxhome.com/file/2023/7/90337_0s.png)