centOS安装mysql5.7详细教程
发表于:2025-11-12 作者:千家信息网编辑
千家信息网最后更新 2025年11月12日,本文为大家分享了centOS下安装mysql5.7详细步骤,供大家参考,具体内容如下第一步:第一句检测系统是否自带安装mysql,若有执行第二句删除系统自带的mysql及其依赖。yum list in
千家信息网最后更新 2025年11月12日centOS安装mysql5.7详细教程
本文为大家分享了centOS下安装mysql5.7详细步骤,供大家参考,具体内容如下
第一步:
第一句检测系统是否自带安装mysql,若有执行第二句删除系统自带的mysql及其依赖。
yum list installed | grep mysqlyum -y remove mysql-libs.x86_64
第二步:
给CentOS添加rpm源,并且选择较新的源,下面代码逐句执行
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpmyum localinstall mysql-community-release-el6-5.noarch.rpmyum repolist all | grep mysqlyum-config-manager --disable mysql55-communityyum-config-manager --disable mysql56-communityyum-config-manager --enable mysql57-community-dmryum repolist enabled | grep mysql
第三步:
安装mysql 服务器
yum install mysql-community-server
第四步:
service mysqld start
第五步:
查看mysql是否自启动,并且设置开启自启动
chkconfig --list | grep mysqldchkconfig mysqld on
第六步:
这一步很重要!!!
不知道从mysql哪个版本开始,mysql的root默认密码就不为空了,在安装的过程中默认密码保存在安装日志中了。我们要通过安装日志找到默认密码,用默认密码登陆mysql成功后会强行让你修改密码,修改的密码还要够复杂(复合mysql默认的密码策略)才能修改成功,一般带大小写字母特殊字符和数字超过8个字符就可以。
首先找到安装日志
find / -name mysqld.log
然后发现该日志文件路径在 /var/log/mysqld.log。然后用下面命令打开,按'i'键上翻
vim /var/log/mysqld.log

上图红色地方就是root密码所在地
第七步:
mysql安全设置
mysql_secure_installation
输入上面命令进行下面步骤
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!In order to log into MySQL to secure it, we'll need the currentpassword for the root user. If you've just installed MySQL, andyou haven't set the root password yet, the password will be blank,so you should just press enter here.Enter current password for root (enter for none):<-初次运行,输入刚刚找到的初始密码,会强制你先修改密码才能进行下去OK, successfully used password, moving on…Setting the root password ensures that nobody can log into the MySQLroot user without the proper authorisation.Set root password? [Y/n] <- 是否设置root用户密码,输入y并回车或直接回车New password: <- 设置root用户的密码Re-enter new password: <- 再输入一次你设置的密码Password updated successfully!Reloading privilege tables..… Success!By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. This is intended only for testing, and to make the installationgo a bit smoother. You should remove them before moving into aproduction environment.Remove anonymous users? [Y/n] <- 是否删除匿名用户,生产环境建议删除,所以直接回车… Success!Normally, root should only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network.Disallow root login remotely? [Y/n] <-是否禁止root远程登录,根据自己的需求选择Y/n并回车,建议禁止… Success!By default, MySQL comes with a database named 'test' that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.Remove test database and access to it? [Y/n] <- 是否删除test数据库,直接回车- Dropping test database…… Success!- Removing privileges on test database…… Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] <- 是否重新加载权限表,直接回车… Success!Cleaning up…All done! If you've completed all of the above steps, your MySQLinstallation should now be secure.Thanks for using MySQL![root@server1 ~]#
第八步:
可选步骤,原来Linux下的MySQL默认是区分表名大小写的,通过如下设置,可以让MySQL不区分表名大小写:
1、用root登录,修改 /etc/my.cnf;
2、在[mysqld]节点下,加入一行: lower_case_table_names=1
3、重启MySQL即可; service mysqld restart
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
密码
输入
大小
日志
步骤
用户
成功
内容
命令
字符
就是
建议
系统
登录
选择
复杂
特殊
重要
安全
一行
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
注意网络安全做到文明上网手抄报
软件开发公司注册哪类商标
java服务器群发
上海税控服务器管理系统要求
四川省粮食数据库平台
乐平 软件开发
go 服务器查内存泄露
计算机网络安全的防范措施
数据库中什么是索引
迈腾导航系统数据库如何更新
用数据库统计广告位出租
北京应用软件开发平台
字节头条网络技术有限公司
数据库 强党建
服务器机房储存设备
梦幻诛仙2新开服务器
网络安全宣传周 安徽
天涯明月刀服务器满怎么挤进去
公司软件开发等级
数据库显示内部服务器错误
如何刷新if公式的数据库
珠海市来来网网络技术有限公司
mimic数据库写的推荐人
网络安全法及相关案例
vba如何查询数据库数据类型
60魔兽数据库.
网易服务器有多少玩家
方舟手游两人联机要买服务器吗
冠军篮球2 数据库
徐州可视化智慧校园软件开发