当前位置:网站首页>[Mysql]安装Mysql5.7
[Mysql]安装Mysql5.7
2022-07-01 18:54:00 【just-do-it-zzj】
目录
安装Mysql5.7
1.概述
本实验用于在Linux7.6安装mysql5.7,用于个人学习Mysql基本功能,生产环境可能并不适用。
2.下载安装包
mysql-community-client-5.7.18-1.el7.x86_64.rpm
mysql-community-common-5.7.18-1.el7.x86_64.rpm
mysql-community-libs-5.7.18-1.el7.x86_64.rpm
mysql-community-server-5.7.18-1.el7.x86_64.rpm
3.安装前检查
说明:如果安装失败或需要重新安装Mysql,也可以参考下面的执行步骤。
3.1 检查是否已经安装mysql
rpm -qa | grep mysql
如果返回结果,则执行删除命令,把包删除
rpm -e mysql-xxx
3.2 检查是否安装 mariadb
rpm -qa | grep mariadb #查找是否有自带mariadb库
如果返回结果,则执行删除命令,把包删除
rpm -e mariadbxxx --nodeps #删除
3.3 检查是否有Mysql相关的配置文件
find / -name mysql #查找与mysql相关的文件或文件夹
如果返回结果,则逐条执行删除命令
rm –rf /xxx/xxx/mysql #删除与mysql有关的文件或文件夹
rm -rf /etc/my.cnf #删除配置文件
4.安装Mysql
rpm安装时,有四个包,安装顺序如下:common—>lib—>client—>server,
卸载时顺序相反。安装里不需要如下两个参数:—force –nodeps,否则可能出错了也没有注意到,反而安装失败。
安装顺序(严格按顺序执行):
rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
5.启动Mysql
5.1 启动
systemctl start mysqld.service
5.2 设置mysql服务为开机启动
systemctl enable mysqld
6.登录和设置
6.1 查询初始密码
安装后首次登录前需要查找初始密码,执行下面的命令查找初始密码
cat /var/log/mysqld.log | grep password
![]()
6.2 登录
mysql -uroot -p<密码>

6.3 设置密码
首次登录后需要修改密码,执行下面的命令修改密码
方式一:
set password for [email protected]=password('[email protected]');
方式二:
set password = password('[email protected]');
alter user 'root'@'localhost' password expire never;
flush privileges;
7.常见问题
7.1 rpm安装时滥用参数--nodeps
安装顺序不对。比如mysql-libs的安装需要mysql-common为前提,如果在没安装mysql-common时,安装mysql-libs时用了—nodeps,将不会提示出错,但实际有问题
边栏推荐
- DS Transunet:用于医学图像分割的双Swin-Transformer U-Net
- Interesting! Database is also serverless!
- Win11怎么关闭开机自启动软件
- 2022/6/8-2022/6/12
- 为定时器和延时器等其它情况的回调函数绑定当前作用域的this
- 开发那些事儿:EasyCVR集群设备管理页面功能展示优化
- The key to the success of digital transformation enterprises is to create value with data
- 实例讲解将Graph Explorer搬上JupyterLab
- 3D全景模型展示可视化技术演示
- C#聯合halcon應用——大華相機采集類
猜你喜欢

数据分析师听起来很高大上?了解这几点你再决定是否转型

Modsim basic use (Modbus simulator)

安装sharp报错

Image acquisition and playback of coaxpress high speed camera based on pxie interface

Test self-study people must see: how to find test items in software testing?

Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?

1592 example 1 King (sgu223 loj10170 luogu1896 increase + / provincial election -) violent thinking pressure DP 01 Backpack

How to configure webrtc video streaming format for easygbs, a new version of national standard gb28181 video platform?

fastDFS入门

Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
随机推荐
Win11快捷键切换输入法无反应怎么办?快捷键切换输入法没有反应
C # joint halcon Application - Dahua Camera Collection class
安装sharp报错
类加载机制
Arduino stepper library drive 28byj-48 stepper motor test program
Test self-study people must see: how to find test items in software testing?
list大集合等比分割成多个小list集合
Powerful, easy-to-use, professional editor / notebook software suitable for programmers / software developers, comprehensive evaluation and comprehensive recommendation
Optimization of video streaming with repeated requests in the case of unstable easygbs network
Understand the structure in C language in one article
【蓝桥杯Web】2022年第十三届蓝桥杯Web大学组国赛真题解析
Image acquisition and playback of coaxpress high speed camera based on pxie interface
开发那些事儿:EasyCVR平台添加播放地址鉴权功能
Hls4ml/vivado HLS error reporting solution
docker ubuntu容器中安装mysql遇到的问题
Interview questions shared in today's group
Example explanation: move graph explorer to jupyterlab
Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, builds an open source ecological road
February 15, 2022: sweeping robot. There is a floor sweeping robot in the room (represented by a grid). Each grid in the grid has two possibilities: empty and obstacles. The sweeping robot provides fo
Tensorflow reports an error, could not load dynamic library 'libcudnn so. eight