Skip to content

Commit 0a5c408

Browse files
author
msbbigdata
committed
upload
1 parent 66b8a8e commit 0a5c408

2 files changed

Lines changed: 156 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Linux下mysql的彻底卸载
2+
3+
### 1、查看mysql的安装情况
4+
5+
```
6+
rpm -qa | grep -i mysql
7+
```
8+
9+
![1570605325400](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570605325400.png)
10+
11+
### 2、删除上图安装的软件
12+
13+
```
14+
rpm -ev mysql-community-libs-5.7.27-1.el6.x86_64 --nodeps
15+
```
16+
17+
### 3、都删除成功之后,查找相关的mysql的文件
18+
19+
```
20+
find / -name mysql
21+
```
22+
23+
![1570605553095](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570605553095.png)
24+
25+
### 4、删除全部文件
26+
27+
```
28+
rm -rf /var/lib/mysql
29+
rm -rf /var/lib/mysql/mysql
30+
rm -rf /etc/logrotate.d/mysql
31+
rm -rf /usr/share/mysql
32+
rm -rf /usr/bin/mysql
33+
rm -rf /usr/lib64/mysql
34+
```
35+
36+
### 5、再次执行命令
37+
38+
```shell
39+
rpm -qa | grep -i mysql
40+
#如果没有显式则表示卸载完成
41+
```
42+
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
2+
3+
# MYSQL5.7详细安装步骤:
4+
5+
### 1、查看系统中是否自带安装mysql
6+
7+
```shell
8+
yum list installed | grep mysql
9+
```
10+
11+
![1570541665646](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570541665646.png)
12+
13+
### 2、删除系统自带的mysql及其依赖(防止冲突)
14+
15+
```shell
16+
yum -y remove mysql-libs.x86_64
17+
```
18+
19+
![1570541838485](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570541838485.png)
20+
21+
### 3、安装wget命令
22+
23+
```
24+
yum install wget -y
25+
```
26+
27+
![1570541946471](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570541946471.png)
28+
29+
### 4、给CentOS添加rpm源,并且选择较新的源
30+
31+
```
32+
wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
33+
```
34+
35+
![1570542045332](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570542045332.png)
36+
37+
### 5、安装下载好的rpm文件
38+
39+
```
40+
yum install mysql-community-release-el6-5.noarch.rpm -y
41+
```
42+
43+
![1570542254949](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570542254949.png)
44+
45+
### 6、安装成功之后,会在/etc/yum.repos.d/文件夹下增加两个文件
46+
47+
![1570542341604](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570542341604.png)
48+
49+
### 7、修改mysql-community.repo文件
50+
51+
原文件:
52+
53+
![1570542415955](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570542415955.png)
54+
55+
修改之后:
56+
57+
![1570542471948](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570542471948.png)
58+
59+
### 8、使用yum安装mysql
60+
61+
```
62+
yum install mysql-community-server -y
63+
```
64+
65+
![1570542688796](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570542688796.png)
66+
67+
### 9、启动mysql服务并设置开机启动
68+
69+
```shell
70+
#启动mysql服务
71+
service mysqld start
72+
#设置mysql开机启动
73+
chkconfig mysqld on
74+
```
75+
76+
### 10、获取mysql的临时密码
77+
78+
```shell
79+
grep "password" /var/log/mysqld.log
80+
```
81+
82+
![1570604493708](C:\Users\seanzhou\Desktop\连老师公开课\typora-user-images\1570604493708.png)
83+
84+
### 11、使用临时密码登录
85+
86+
```shell
87+
mysql -uroot -p
88+
#输入密码
89+
```
90+
91+
### 12、修改密码
92+
93+
```sql
94+
set global validate_password_policy=0;
95+
set global validate_password_length=1;
96+
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
97+
```
98+
99+
### 13、修改远程访问权限
100+
101+
```sql
102+
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
103+
flush privileges;
104+
```
105+
106+
### 14、设置字符集为utf-8
107+
108+
```shell
109+
#在[mysqld]部分添加:
110+
character-set-server=utf8
111+
#在文件末尾新增[client]段,并在[client]段添加:
112+
default-character-set=utf8
113+
```
114+

0 commit comments

Comments
 (0)