当前位置:网站首页>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开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担.添加下方名片,即可获取全套学习资料哦
边栏推荐
- Cesium加载离线地图和离线地形
- 防抖和节流有什么区别,分别用于什么场景?
- LeetCode每日一题(1717. Maximum Score From Removing Substrings)
- MySQL六脉神剑,SQL通关大总结
- MySQL分组后取最大一条数据【最优解】
- mysql慢查询优化
- After watching "Second Uncle", I was even more internalized
- 【flink】报错整理 Could not instantiate the executor. Make sure a planner module is on the classpath
- MindSpore:【语音识别】DFCNN网络训练loss不收敛
- VBA connects Access database and Excel
猜你喜欢
随机推荐
Difference between Object and Map
牛客刷题系列之进阶版(组队竞赛,排序子序列,倒置字符串, 删除公共字符,修理牧场)
vxe-table实现复选框鼠标拖动选中
VBA runtime error '-2147217900 (80040e14): Automation error
看完《二舅》,我更内耗了
Spark学习:用spark实现ETL
MySQL数据库 ---MySQL表的增删改查(进阶)
nlohmann json 使用指南【visual studio 2022】
阿里面试官:给我描述一下缓存击穿的现象,并说说你的解决思路?
MySQL slow query optimization
Win11如何更改默认下载路径?Win11更改默认下载路径的方法
Delay queue optimization (2)
Start background services across processes
Vulkan开启特征(feature)的正确姿势
JS提升:Promise中reject与then之间的关系
Go system collection
MySQL八股文背诵版
MindSpore:【语音识别】DFCNN网络训练loss不收敛
监听开机广播
MySQL database - views and indexes









