当前位置:网站首页>CentOS7 安装MySQL 图文详细教程
CentOS7 安装MySQL 图文详细教程
2022-08-02 21:51:00 【模糊化的】
目录
7.?安装完之后修改当前目录拥有者为root用户,修改data目录拥有者为mysql
一. 检查是否已经安装过MySQL
这里介绍两种方法
方法一
1.rpm查看mysql安装
rpm -qa|grep -i mysql
2.卸载前关闭mysql服务
rpm -ev --nodepsmysql-community-release-el7-5.noarch
rpm -ev --nodepsmysql-community-common-5.6.38-2.el7.x86_64
…
执行完命令之后再次执行 rpm-qa|grep -i mysql 会发现已经卸载完成。
方法二
1. 执行命令 查找mysql文件夹
find / -name mysql

2. 把查找出的目录删除
rm -rf /run/lock/subsys/mysql /usr/local/mysql /usr/local/mysql/include/mysql /usr/local/mysql/data/mysql /usr/local/mysql/bin/mysql
二.安装MySQL
1.将压缩包传到服务器
我这里用的是mysql-5.6.36 , 如需其他版本可自行下载
这里是mysql-5.6.36的压缩包 :
链接:https://pan.baidu.com/s/1Kles21GxwyfEkyqicgyzhQ?pwd=sin7
提取码:sin7
2. 解压文件
tar -zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
3.重命名解压后的文件
mv mysql-5.6.36-linux-glibc2.5-x86_64/ mysql
4.检查是否有mysql用户组和mysql用户
groups mysql
若有----跳过此步
若无----添加
groupadd mysql
useradd -r -g mysql mysql
5.进入mysql目录-----更新权限
cd mysql/
chown -R mysql:mysql ./
6.执行安装脚本
./scripts/mysql_install_db --user=mysql
如果提示 FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:Data::Dumper的话,那么原因是缺少perl-module
yum -y install perl-Module-Install.noarch
安装perl-module模块,等待perl-module安装成功之后,再继续执行上一步安装

7.安装完之后修改当前目录拥有者为root用户,修改data目录拥有者为mysql
chown -R root:root ./
chown -R mysql:mysql data
8.启动mysql
./support-files/mysql.server start

9. 修改密码
./bin/mysqladmin -u root password ‘你的密码’
10.登录
./bin/mysql -h127.0.0.1 -uroot -p
输入刚设置的密码即可登录

11.添加远程登录权限
grant all privileges on *.* to [email protected]‘%’ identified by ‘你的密码’;
flush privileges;
12. 将MySQL注册为服务
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add
mysqld chkconfig mysqld on
service mysqld restart(重启)
service mysqld status (状态)
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
猜你喜欢

Auto.js脚本程序打包

目前为止 DAO靠什么盈利?

Task 4 Machine Learning Library Scikit-learn

The interviewer asked me: delete library, in addition to run do?

最近火爆朋友圈的“广告电商”,核心商业模式是什么,广告收入真实靠谱吗?

IP协议(网际协议)

SSM integration steps (emphasis)

软件测试笔试题1(附答案)

牛客每日刷题之链表

【使用pyside2遇到的问题】This application failed to start because no Qt platform plugin could be initialized.
随机推荐
Unity WallFxPack使用
CodeTON Round 2 A - D
圆锥折射作为偏振计量工具的模拟
What is the core business model of the "advertising e-commerce" that has recently become popular in the circle of friends, and is the advertising revenue really reliable?
一群搞社区的人
JumpServer open source bastion machine completes Loongson architecture compatibility certification
任务四 机器学习库Scikit-learn
FRED应用:激光二极管光源耦合到光纤的仿真
Shunted Self-Attention via Multi-Scale Token Aggregation
宝塔搭建实测-基于ThinkPHP5.1的wms进销存源码
不堪哥哥殴打谩骂,妹妹申请人身安全保护令获支持
Abstract Factory Pattern
js function anti-shake and function throttling and other usage scenarios
win10桌面图标全部变成白色的怎么办
【STM32学习2】存储器相关概念与操作
[TypeScript] Deep Learning of TypeScript Classes (Part 1)
【C语言】带头双向循环链表(list)详解(定义、增、删、查、改)
Go语言如何操作文件
go rand 包
Flink-shell