CentOS安装Mysql步骤
2022/1/12 19:35:30
本文主要是介绍CentOS安装Mysql步骤,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
CentOS安装Mysql步骤
-
下载wget命令
yum -y install wget
-
在线下载安装包
wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
-
安装Mysql
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
-
安装MySQL服务(这个过程比较慢,耐心等待)
cd /etc/yum.repos.d/ yum -y install mysql-server
-
启动MySQL服务
systemctl start mysqld.service #或 systemctl start mysqld
-
查找默认密码
grep "password" /var/log/mysqld.log
-
使用默认密码登录
mysql -uroot -p
-
更改密码时,如果想降低密码的复杂度优先执行此步骤。
#密码校验强度降低为低风险 set global validate_password_policy=LOW; #修改设置密码的长度 set global validate_password_length=6;
-
更改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; #退出MySQL exit;
到此步,MySQL已顺利安装完成,接下来配置远程访问MySQL
-
执行以下命令开启远程访问限制 (在MySQL中执行)
#192.168.0.1换成自己的IP地址,password为设置MySQL远程登录的密码 grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option;
-
开启防火墙,但防火墙添加开放端口3306
#开启防火墙 systemctl start firewalld.service # 开放3306端口 firewall-cmd --zone=public --add-port=3306/tcp --permanent #配置立即生效 firewall-cmd --reload ####如有需要,关闭某个端口 #关闭3306端口 firewall-cmd --zone=public --remove-port=3306/tcp --permanent #查看防火墙状态 firewall-cmd --state
好的教程:
-
https://blog.csdn.net/weixin_42140801/article/details/107859925?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162925229016780269871176%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=162925229016780269871176&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2alltop_positive~default-1-107859925.first_rank_v2_pc_rank_v29&utm_term=centos7%E5%AE%89%E8%A3%85mysql&spm=1018.2226.3001.4187
-
https://blog.csdn.net/Bb15070047748/article/details/106245223?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162925229016780269871176%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=162925229016780269871176&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2alltop_positive~default-2-106245223.first_rank_v2_pc_rank_v29&utm_term=centos7%E5%AE%89%E8%A3%85mysql&spm=1018.2226.3001.4187
这篇关于CentOS安装Mysql步骤的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-25如何部署MySQL集群资料:新手入门教程
- 2024-12-24MySQL集群部署资料:新手入门教程
- 2024-12-24MySQL集群资料详解:新手入门教程
- 2024-12-24MySQL集群部署入门教程
- 2024-12-24部署MySQL集群学习:新手入门教程
- 2024-12-24部署MySQL集群入门:一步一步搭建指南
- 2024-12-07MySQL读写分离入门:轻松掌握数据库读写分离技术
- 2024-12-07MySQL读写分离入门教程
- 2024-12-07MySQL分库分表入门详解
- 2024-12-07MySQL分库分表入门指南