当前位置:网站首页>Linux download and install mysql5.7 version tutorial the most complete and detailed explanation
Linux download and install mysql5.7 version tutorial the most complete and detailed explanation
2022-07-30 19:37:00 【m0_67401382】
linux下安装mysql 5.7.31
下载mysql文件
下载mysql文件5.7.31包,I have already upload the file.也可以点击下载 如下图所示:
删除Linux下默认安装的MariaDB
# 查找mariadb安装包名字
rpm -qa | grep -i mariadb
# 卸载mariadb安装包,mariadb-libs-5.5.52-1.x86 Is the result of a command on the found
rpm -e --nodeps mariadb-libs-5.5.52-1.x86
上传文件并解压
Create to upload directory,这里我的目录为
cd /opt/myinstall
mkdir mysql
将mysqlThe installation package uploaded to the directory,然后解压
tar -xvf mysql-5.7.31-1.el7.x86_64.tar
安装
rpm -ivh mysql-community-common-5.7.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.31-1.el7.x86_64.rpm
安装报错
If you install the last stepserver的时候,报错,说明缺少依赖包libaio可以点击下载 然后下载依赖包
Then download package uploaded tolinux后执行
rpm -ivh libaio-0.3.112-1.el8.x86_64.rpm
And then re-execute wouldn't be an error
rpm -ivh mysql-community-server-5.7.31-1.el7.x86_64.rpm
至此,mysql数据库就安装完成了
启动mysqld服务
执行以下命令
# 启动服务 After command Spaces, an
systemctl start mysqld
# 查看服务状态
systemctl status mysqld
其它命令
# 停止服务
systemctl stop mysqld
# 重启服务
systemctl restart mysqld
修改mysql的登录密码
设置跳过登录密码
vi /etc/my.cnf
在最后一行添加代码
# 跳过密码登录
skip-grant-tables
保存后,然后重启服务
systemctl restart mysqld
登录mysql,Have just set the skip the login password,So we just input the login command,It is ok to enter twice
mysql -u root -p
查看rootThe user's password command
修改密码为:123456
If change the passwordsql报错
修改validate_password_policy参数的值, Modified to allow password length
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
然后重启服务
输入quit退出mysql交互界面
At this point the skip password configuration code just configuration are removed or commented out ok.
然后再次重启mysqld服务
systemctl restart mysqld
然后输入命令
mysql -u root -p
输入刚才设置的密码:123456,出现mysqlInteraction shows just set success.
设置编码格式
修改配置文件
vi /etc/my.cnf
# 在[mysqld]下添加
collation_server=utf8_general_ci
character_set_server=utf8
default-storage-engine=INNODB
# 在[client]下添加(如果没有[client],则创建[client])
[client]
default_character-set=utf8
保存,然后重启mysql服务
systemctl restart mysqld
登录mysql
mysql -u root -p 123456
查看mysql编码
show variables like 'character_set_%';
To view changes at this timemysqlCoding forUTF-8了
开启远程连接
登录mysql
mysql -u root -p 123456
执行以下命令
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
# 立即生效
mysql> FLUSH PRIVILEGES;
Just ordered explain
123456是登录密码
*.* All said all database under the table
'root'@'%' 表示所有主机的root
If you set an error
In this reason is because the password is too simple,mysqlPassword strength check(密码设置时必须包含大小写字母,特殊符号,数字,并且长度大于8位)
解决办法:Must modify the two global configuration parameters(临时更改,如果重新进入,需要重新修改)
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
然后重新执行命令修改配置文件
vi /etc/my.cnf
bind-address如果是127.0.0.1,mysql只接受localhost,不接受远程连接.在bind-address后面增加远程访问IP地址或者禁掉这句话就可以让远程机登陆访问了.
如果地址是 0.0.0.0, Accept all serviceIPV4的接口;
如果地址是 ::, tAccept all serviceIPV4和 IPv6 的接口;
修改端口
登录mysql
mysql -u root -p 123456
查看端口
show global variables like ‘port’;
As you can see now the port is3306
修改配置文件
vi /etc/my.cnf
然后保存退出
重启mysql
systemctl restart mysqld
Port changes to complete at this time
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在.深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小.自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前.因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担.添加下方名片,即可获取全套学习资料哦
边栏推荐
- Download Win11 how to change the default path?Download Win11 change the default path method
- 深入浅出边缘云 | 3. 资源配置
- 第一次进入小程序判断
- musicApp 的.eslintrc.js
- MindSpore:mindspore有没有类似tf.GradientTape()用来求解梯度的?
- Scala学习:breakable
- 技术很牛逼,还需要“向上管理”吗?
- 【MindSpore】用coco2017训练Model_zoo上的 yolov4,迭代了两千多batch_size之后报错,大佬们帮忙看看。
- The 17th "Revitalization Cup" National Youth Vocational Skills Competition - Computer Programmers (Cloud Computing Platform and Operation and Maintenance) Participation Review and Summary
- PostgreSQL 14.4如何安装使用
猜你喜欢
[hbuilder] cannot run some projects, open the terminal and cannot enter commands
【MindSpore】多卡训练保存权重问题
SimpleOSS third-party library libcurl and engine libcurl error solution
谷歌AlphaFold近日宣称预测出地球上几乎所有蛋白质结构
牛客刷题系列之进阶版(组队竞赛,排序子序列,倒置字符串, 删除公共字符,修理牧场)
MySQL分库分表
Linux下载安装mysql5.7版本教程最全详解
vxe-table实现复选框鼠标拖动选中
MySQL函数(经典收藏)
MySQL分组后取最大一条数据【最优解】
随机推荐
MySQL sub-database sub-table
LeetCode 0952.按公因数计算最大组件大小:建图 / 并查集
mysql慢查询优化
MindSpore:ImageFolderDataset数据读取问题
Cesium加载离线地图和离线地形
How to install and use PostgreSQL 14.4
VBA connects Access database and Excel
SimpleOSS third-party library libcurl and engine libcurl error solution
MongoDB打破了原则引入SQL?
Difference between Object and Map
阿里面试这些微服务还不会?那还是别去了,基本等通知
NXP IMX8QXP replacement DDR model operation process
Listen to the boot broadcast
浅聊对比学习(Contrastive Learning)第一弹
7.29模拟赛总结
Download and installation of the latest version of MySQL 8.0 under Linux (detailed steps)
第一次进入小程序判断
MindSpore:自定义dataset的tensor问题
The 17th "Revitalization Cup" National Youth Vocational Skills Competition - Computer Programmers (Cloud Computing Platform and Operation and Maintenance) Participation Review and Summary
MindSpore:【JupyterLab】按照新手教程训练时报错