当前位置:网站首页>Centos7 install mysql5.7 steps (graphical version)
Centos7 install mysql5.7 steps (graphical version)
2022-07-31 04:52:00 【jiey0407】
目录
一、下载mysql5.7安装包

二、mysql5.7安装包上传到linux服务器
linux服务器根目录下新建文件夹:
1)、 tool文件夹,存放软件安装包
2)、 xz文件夹,存放安装后的软件将下载好的mysql-5.7.36-linux-glibc2.12-x86_64.tar.gz上传至tool文件夹下:

三、检查系统是否安装过mysql
检查系统是否安装过mysql,如果没有略过此步骤:如下图:
//检查系统中有无安装过mysql [[email protected] tool]# rpm -qa|grep mysql
如果系统自带mysql,查询所有mysql 对应的文件夹,全部删除
whereis mysql find / -name mysql
四、卸载CentOS7系统自带mariadb
查看系统自带的Mariadb
rpm -qa|grep mariadb卸载系统自带的Mariadb
rpm -e --nodeps mariadb-libs-5.5.60-1.el7-5.x86_64删除etc目录下的my.cnf ,一定要删掉,等下再重新建,之前我将就用这个文件,后面改配置各种不生效,因为lz此目录下没有my.cnf文件,没有执行可命令
rm /etc/my.cnf以上命令截图如下:


五、检查有无安装过mysql 用户组,没有的话创建
检查mysql 用户组是否存在
cat /etc/group | grep mysql cat /etc/passwd |grep mysql
创建mysql 用户组和用户
groupadd mysql useradd -r -g mysql mysql

六、安装mysql5.7步骤
解压安装mysql安装包到/xz/目录下
tar -zxvf mysql-5.7.36-linux-glibc2.12-x86_64.tar.gz -C /xz/
修改mysql-5.7.36-linux-glibc2.12-x86_64名称为mysql5.7
mv mysql-5.7.36-linux-glibc2.12-x86_64/ mysql5.7
更改mysql5.7 目录下所有文件夹所属的用户组、用户以及权限
chown -R mysql:mysql /xz/mysql5.7 chmod -R 755 /xz/mysql5.7
进入/xz/mysql5.7/bin/目录,编译安装并初始化mysql,务必记住数据库管理员临时密码,如下图画红色框的部分.
./mysqld --initialize --user=mysql --datadir=/xz/mysql5.7/data --basedir=/xz/mysql5.7
编写etc目录下的my.cnf 配置文件,并添加配置
//进入配置文件 vi /etc/my.cnf //在插入模式下编写,完成后保存,当然这个可以自己添加 [mysqld] datadir=/xz/mysql5.7/data port = 3306 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES symbolic-links=0 max_connections=400 innodb_file_per_table=1 #表名大小写不明感,敏感为 lower_case_table_names=1授予my.cnf 配置文件775权限,如下:
chmod -R 775 /etc/my.cnf
修改/xz/mysql5.7/support-files/目录下的mysql.server文件,如下图中5个位置的/usr/local/mysql全部修改成/xz/mysql5.7.因为lz没有安装下/usr/local/mysq目录下,所以需要修改成lz安装的/xz/mysql5.7目录.

启动mysql 服务器
1)、查询服务ps -ef|grep mysql ps -ef|grep mysqld
2)、启动服务
/xz/mysql5.7/support-files/mysql.server start
添加软连接,并重启mysql 服务
//添加软连接 ln -s /xz/mysql5.7/support-files/mysql.server /etc/init.d/mysql ln -s /xz/mysql5.7/bin/mysql /usr/bin/mysql //重启mysql服务 service mysql restart
登录mysql ,密码就是初始化时生成的临时密码
mysql -u root -p
修改密码为root
set password for [email protected] = password('root');
开放远程连接
use mysql; update user set user.Host='%' where user.User='root'; flush privileges;
设置开机自启
//将服务文件拷贝到init.d下,并重命名为mysql cp /xz/mysql5.7/support-files/mysql.server /etc/init.d/mysqld //赋予可执行权限 chmod +x /etc/init.d/mysqld //添加服务 chkconfig --add mysqld //显示服务列表 chkconfig --list
开放3306端口,测试本地客户端是否连接成功
//开放3306端口命令 firewall-cmd --zone=public --add-port=3306/tcp --permanent //配置立即生效 firewall-cmd --reload

至此,centos7安装mysql5.7完成,本客户端连接centos7中的mysql5.7服务端成功.
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在.深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小.自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前.因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担.添加下方名片,即可获取全套学习资料哦
边栏推荐
- Go language study notes - dealing with timeout problems - Context usage | Go language from scratch
- mysql数据库安装(详细)
- MySQL事务(transaction) (有这篇就足够了..)
- 微信小程序使用云函数更新和添加云数据库嵌套数组元素
- Blockbuster | foundation for platinum, gold, silver gave nameboards donors
- 矩池云快速安装torch-sparse、torch-geometric等包
- [py script] batch binarization processing images
- Musk talks to the "virtual version" of Musk, how far is the brain-computer interaction technology from us
- MySQL开窗函数
- MySQL database must add, delete, search and modify operations (CRUD)
猜你喜欢

centos7安装mysql5.7步骤(图解版)

【云原生】DevOps(五):集成Harbor

Musk talks to the "virtual version" of Musk, how far is the brain-computer interaction technology from us

MySQL optimization: from ten seconds to three hundred milliseconds

MySQL开窗函数

Doris学习笔记之监控

ENSP, VLAN division, static routing, comprehensive configuration of Layer 3 switches

Solved (the latest version of selenium framework element positioning error) NameError: name 'By' is not defined
![[Linear Neural Network] softmax regression](/img/98/ffdff5e96ad0d6ac0142af7ca11e9a.png)
[Linear Neural Network] softmax regression

The MySQL database installed configuration nanny level tutorial for 8.0.29 (for example) have hands
随机推荐
Reinforcement learning: from entry to pit to shit
On Governance and Innovation | 2022 OpenAtom Global Open Source Summit OpenAnolis sub-forum was successfully held
MySQL事务(transaction) (有这篇就足够了..)
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法
The third is the code to achieve
[Linear Neural Network] softmax regression
Gaussian distribution and its maximum likelihood estimation
Go language study notes - dealing with timeout problems - Context usage | Go language from scratch
Win10 CUDA CUDNN installation configuration (torch paddlepaddle)
MATLAB/Simulink & & STM32CubeMX tool chain completes model-based design development (MBD) (three)
打造基于ILRuntime热更新的组件化开发
Puzzle Game Level Design: Reverse Method--Explaining Puzzle Game Level Design
Doris学习笔记之监控
Unity URP渲染管线摄像机核心机制剖析
Unity教程:URP渲染管线实战教程系列【1】
VScode+ESP32快速安装ESP-IDF插件
WeChat applet uses cloud functions to update and add cloud database nested array elements
MySQL优化之慢日志查询
ERP生产作业控制 金蝶
MySQL开窗函数

