mysql安装
2021/9/14 2:06:33
本文主要是介绍mysql安装,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
查看防火墙状态
systemctl status firewalld.service
启动防火墙
systemctl start firewalld.service
2、修改主机名
第一种
hostnamectl set-hostname base
第二种
vim /etc/hostname
查看主机名
hostnamectl status
3、修改ip地址
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.129.211
NETMASK=255.255.255.0
GATEWAY=192.168.129.2
DNS1=192.168.129.2
4、安装mysql5.7
下载yum Repository
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
安装yum Repository
yum -y install mysql57-community-release-el7-10.noarch.rpm
安装mysql5.7
yum -y install mysql-community-server
开机自启动
systemctl enable mysqld.service
启动mysql
systemctl start mysqld.service
查看状态
systemctl status mysqld.service
获取临时密码
grep "password" /var/log/mysqld.log
登录mysql
mysql -uroot -p
关闭密码复杂验证
set global validate_password_policy=0;
set global validate_password_length=1;
设置密码
alter user user() identified by "123456";
修改权限
use mysql;
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; --修改权限
flush privileges; --刷新权限
select host,user,authentication_string from user; --查看权限
卸载yum Repository
因为安装了Yum Repository,以后每次yum操作都会自动更新,需要把这个卸载掉:
yum -y remove mysql57-community-release-el7-10.noarch
4、卸载mysql
删除依赖包
rpm -qa |grep -i mysql
yum remove mysql-community mysql-community-server mysql-community-libs mysql-community-common
清理文件
find / -name mysql
rm -rf 文件名
这篇关于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分库分表入门指南