添加 '数据库/mysql/mysql5.7安装.md'
This commit is contained in:
parent
f75bc9dbba
commit
78618c4cd1
1 changed files with 37 additions and 0 deletions
37
数据库/mysql/mysql5.7安装.md
Normal file
37
数据库/mysql/mysql5.7安装.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
## 1、查询系统中安装的mysql/mariadb版本
|
||||
```shell
|
||||
rpm -qa | grep mysql
|
||||
rpm -qa | grep mariadb
|
||||
```
|
||||
### 2、卸载
|
||||
```shell
|
||||
rpm -e --nodeps mariadb-libs
|
||||
```
|
||||
### 3、安装mysql
|
||||
```
|
||||
# 以common -> libs -> client -> server顺序安装mysql
|
||||
yum -y localinstall mysql-community-common-5.7.41-1.el7.x86_64.rpm
|
||||
yum -y localinstall mysql-community-libs-5.7.41-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.41-1.el7.x86_64.rpm
|
||||
yum -y localinstall mysql-community-client-5.7.41-1.el7.x86_64.rpm
|
||||
yum -y localinstall mysql-community-server-5.7.41-1.el7.x86_64.rpm
|
||||
```
|
||||
### (选项)4、修改端口/数据目录
|
||||
```shell
|
||||
[mysqld]
|
||||
port=3307
|
||||
datadir=/data/mysql
|
||||
```
|
||||
### 5、启动mysql
|
||||
```shell
|
||||
systemctl start mysqld
|
||||
```
|
||||
### 6、查看初始密码
|
||||
```shell
|
||||
grep 'temporary password' /var/log/mysqld.log
|
||||
```
|
||||
### 7、修改密码
|
||||
```sql
|
||||
mysql -u root -p
|
||||
set password = password("xxxxxxxx");
|
||||
flush privileges;
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue