当前位置:网站首页>CentOs7安装mysql5.7解压版
CentOs7安装mysql5.7解压版
2022-07-18 18:03:00 【一个小白QAQ】
CentOs7安装mysql5.7解压版
1、下载
使用命令下载tar压缩包,下载过程可能有点长网速快的话几分钟,大概六百多兆左右
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
2、卸载自带的mariadb
查看系统系是否自带mariadb(若没有任何输出可忽略此步骤)
rpm -qa | grep mariadb
删除列出的所有文件
rpm -e --nodeps 列出的文件名
删除所有和mariadb有关的文件包
yum -y remove mari*
3、卸载之前为安装成功的mysql(如果是第一次安装可忽略此步骤)
3.1 检查是否有以rmp包安装的mysql
rpm -qa|grep -i mysql
如果有则使用下面命令删除列出的
rpm -e 列出的文件
3.2 列出所有mysql相关的文件
find / -name mysql
删除所有列出的文件夹
rm -rf 列出的文件
4、解压安装
4.1使用命令解压安装包
tar -zxvf mysql-5.7.32-linux-glibc2.12-x86_64.tar.gz
将解压出来的文件移动至/usr/local并重命名为mysql
mv mysql-5.7.32-linux-glibc2.12-x86_64 /usr/local/mysql
进入mysql目录,创建data文件
cd /usr/local/mysql
mkdir data
4.2创建mysql用户和组,并赋予文件所有者及所有组
groupadd mysql
useradd mysql -g mysql
chown -R mysql.mysql /usr/local/mysql
4.3 安装numactl
yum -y install numactl
4.4安装mysql服务
/usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize
4.5编写配置文件
打开 /etc/my.cnf
vim /etc/my.cnf
复制下面代码进去
[mysql]
#修改默认字符集
default-character-set=utf8
socket=/usr/local/mysql/mysql.sockt
[mysqld]
socket=/usr/local/mysql/mysql.sockt
log_error=/usr/local/mysql/data/error.log
pid_file=/usr/local/mysql/data/mysql.pid
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
#忽略大小写
lower_case_table_names=1
#服务端默认字符集
character-set-server=utf8
#最大连接数
max_connections=2000
#创建数据库时默认数据引擎
default-storage-engine=INNODB
explicit_defaults_for_timestamp=true
#跳过密码验证使用
skip-grant-tables
保存退出 wq
4.6加入环境变量
打开/etc/profile
vim /etc/profile
复制下面代码到文档最后一行
export PATH=$PATH:/usr/local/mysql/bin
刷新配置文件使生效
source /etc/profile
设置开机自启动(根据自己需要)
chkconfig mysql on
加入系统服务
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
启动服务
service mysql start
出现以上信息,则服务启动成功。
5、登陆修改密码
mysql -u root -p
此时会出现提示输入密码,不需要输入,直接按回车跳过!!!!
输入以下命令修改密码
use mysql;
update user set authentication_string=password('你自己设置的密码') where user='root';
刷新使设置生效
flush privileges;
然后退出
exit;
重新进入配置文件,删掉跳过登陆验证
vim /etc/my.cnf
进入后删除最后一行代码,然后wq保存退出即可
安装完成!!
边栏推荐
- Collection! SolidWorks device layout tool: SolidWorks asset publisher
- 字符串常见方法:构造方法,其他方法
- VR safety education fire safety carry out fire knowledge, skills and practical training teaching step by step
- Route policy overview learning
- Hoops 2022 product update summit came in May, and 3D core technology was further improved. See you or leave
- Improve the efficiency of drawing, can you still play like this? A trick to teach you never to repeat the drawing again
- 重写与重载
- CISP test questions
- How to realize vr virtual reality display
- JVM和GC学习总结
猜你喜欢
Hoops web platform helped rapid DCS develop carbon estimation products and successfully launched them in 6 months
2022-07-10 group 5 Gu Xiangquan's learning notes day03
Production scheme and process of online virtual exhibition hall
IO流——内存流、对象流
2022-07-12 group 5 Gu Xiangquan's learning notes day05
Panoramic viewing VR panoramic display, get a 360 degree panoramic perspective real-time interactive experience
How to implement SolidWorks batch modification of drawing templates?
Function introduction of digital vr virtual museum
Excel文件解析
CISP-PTE报考条件及申请流程
随机推荐
SolidWorks live class | implementation of 3D parametric modeling
字符串常见方法:构造方法,其他方法
牛客sql第八题 SELECT DISTINCT
盘点信息安全CISP家族热门认证
properties文件的读取和写入
How to realize online 3D model display
Six certificates related to data governance are most worthy of recommendation. Remember to collect them!
The role of 360 online virtual reality panoramic exhibition hall Technology
网络安全相关证书有哪些?
Cisp-pte registration conditions and application process
路由协议BGP的概述学习——入门必看
Is CDMP certificate difficult to test?
zip文件的读取和写入
卸载yum安装的zabbix软件
Visual digital twin smart Park simulation display construction scheme
How to realize vr virtual reality display
如何实现Solidworks批量修改工程图模板?
AQS实现原理
cisp-pte必须参加教育学习吗?
URL编码/解码