当前位置:网站首页>[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,将不会提示出错,但实际有问题
边栏推荐
- Detailed configuration of network security "Splunk" in national vocational college skills competition
- 【let var const】
- Install redis under Linux and configure the environment
- 新窗口打开页面-window.open
- 新增订单如何防止重复提交
- 1592 例题1 国王(Sgu223 LOJ10170 LUOGU1896 提高+/省选-) 暴力思考 状压DP 01背包
- 墨天轮沙龙 | 清华乔嘉林:Apache IoTDB,源于清华,建设开源生态之路
- Test self-study people must see: how to find test items in software testing?
- EasyCVR集群视频广场页面切换时,请求流未能终止的问题优化
- 振弦采集模块测量振弦传感器的流程步骤
猜你喜欢
Is Dao safe? Build finance encountered a malicious governance takeover and was looted!
HLS4ML报错The board_part definition was not found for tul.com.tw:pynq-z2:part0:1.0.
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
墨天轮沙龙 | 清华乔嘉林:Apache IoTDB,源于清华,建设开源生态之路
Interesting! Database is also serverless!
MYSLQ十种锁,一篇文章带你全解析
GC垃圾回收
Example explanation: move graph explorer to jupyterlab
JS的Proxy
Bind this of the current scope for callback functions in other cases such as timers and delayers
随机推荐
CMU AI PhD first year summary
Hls4ml/vivado HLS error reporting solution
一个悄然崛起的国产软件,低调又强大!
MYSLQ十种锁,一篇文章带你全解析
对金额进行求和
全国职业院校技能大赛网络安全“splunk“详细配置
有意思了!数据库也搞Serverless!
Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, builds an open source ecological road
EasyCVR通过国标GB28181协议接入设备,出现设备自动拉流是什么原因?
Anaconda installs the virtual environment to the specified path
The large list set is divided into multiple small list sets in equal proportion
Interesting! Database is also serverless!
2022/5/23-2022/5/30
How to add transactions in JDBC
Linux下安装Redis,并配置环境
Optimization of video streaming with repeated requests in the case of unstable easygbs network
【无标题】
Test self-study people must see: how to find test items in software testing?
基于图的 Affinity Propagation 聚类计算公式详解和代码示例
为定时器和延时器等其它情况的回调函数绑定当前作用域的this