标签:安装过程 down span 今天 www mmu grep 卸载 base
以前安装过几十次的mysql。今天还是遇到问题(虽然是因为是局域网ip不通无法远程连接),记录一个完整的安装过程。
yum安装之后如果需要卸载
1.命令 rpm -qa | grep -i mysql 或者 yum list installed | grep mysql 查看安装的mysql安装包
将查出来的安装包通过yum remove 卸载 yum remove mysql-community-server-***
2. 卸载mysql文件目录
find / -name mysql | xargs rm -rf
1.下载mysql
方法一官网下载
https://dev.mysql.com/downloads/mysql/5.7.html#downloads
方法二(选择这个)
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
2.安装rpm包
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
安装成功后 /etc/yum.repos.d/ 目录下 多两个文件 mysql-community.repo和mysql-community-source.repo
3.安装mysql
yum install -y mysql-server
安装成功查看 mysql -V
4,运行mysql
service mysqld start
5.查看随机密码
grep "password" /var/log/mysqld.log
6.登录
mysql -u root -p
密码是第五步得到的
7.修改密码
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘NewPass123!‘;(要带分号)
设置密码永不过期
ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER;
#刷新MySQL的系统权限相关表
flush privileges;
8.设置远程登录
所有ip下以及在本地可访问
grant all privileges on *.* to root@"localhost" identified by "NewPass123!";
grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘NewPass123!‘ with grant option;
flush privileges;
解释:
grant all privileges on 数据库名称.* to 数据库用户名@‘授权范围‘ identified by ‘数据库用户名密码‘;
grant all privileges on wxactivity.* to mysqluser@‘%‘ identified by ‘mysqluseradmin‘;(这是例子,%代表授权全网,localhost代表授权本机)
9.创建数据库(可不做)
create database 数据库名称 ;(注意分号结尾)
10.新建用户(可不做)
CREATE USER ‘xld_test‘@‘%‘ IDENTIFIED BY ‘你的密码‘;
11.用户授权(可不做)
添加用户权限: GRANT ALL ON databasename.tablename TO ‘xld_test‘@‘%‘;
撤销用户权限: REVOKE ALL ON databasename.tablename TO ‘xld_test‘@‘%‘;
删除用户及权限 :drop user ‘xld_test‘@‘%‘;
1.安装sqlyog
https://www.jianshu.com/p/46ea86e099d2
2.sqlyog连接远程mysql
关闭防火墙 https://blog.csdn.net/baidu_36124158/article/details/90603496
1:查看防火状态
systemctl status firewalld
service iptables status
2:暂时关闭防火墙
systemctl stop firewalld
service iptables stop
3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off
4:重启防火墙
systemctl enable firewalld
service iptables restart
3.linux查看mysql状态
netstat -ntlp 和 service mysqld status
参考 https://www.cnblogs.com/syncmr/p/11991050.html
标签:安装过程 down span 今天 www mmu grep 卸载 base
原文地址:https://www.cnblogs.com/pergrand/p/13183751.html