<commit_before>---
layout: post
title: mysql安装
category: 学习
keywords: 学习,2018
---


# mysql 安装

## 注意点

1. mysql一定安装社区源
2. 安装好后root可以不用密码login


## 安装

1. 下载并更新源

```

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update

```

2. 安装服务


```

yum install mysql-server
systemctl start mysqld

```

## 安全设置 

mysql_secure_installation


## root 登录

1. 

``` 

mysql -u root -p 

```


## 重设mysql root password密码

1. 
```

systemctl stop mysqld
mysqld_safe --skip-grant-tables &

```

2. 

```

mysql -u root 

```

3. 

```

use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
flush privileges;

```

4. 

```

systemctl start mysqld


```

## 参考

[how-to-install-mysql-on-centos-7](https://linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7/)<commit_msg>修改格式问题<commit_after>---
layout: post
title: mysql安装
category: 学习
keywords: 学习,2018
---


# mysql 安装

## 注意点

1. mysql一定安装社区源
2. 安装好后root可以不用密码login


## 安装

1. 下载并更新源

```

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update

```

2. 安装服务


```

yum install mysql-server
systemctl start mysqld

```

## 安全设置 

mysql_secure_installation


## root 登录

1. 

``` 

mysql -u root -p 

```


## 重设mysql root password密码

1. 
```

systemctl stop mysqld
mysqld_safe --skip-grant-tables &

```

2. 

```

mysql -u root 

```

3. 

```

use mysql;
update user SET PASSWORD=PASSWORD("password") WHERE USER='root';
flush privileges;

```

4. 


```

systemctl start mysqld


```

## 参考

[how-to-install-mysql-on-centos-7](https://linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7/)
{'fraction_non_alphanumeric': 0.1645422943221321, 'fraction_numerical': 0.0220162224797219, 'mean_word_length': 3.1315789473684212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4205706', 'n_tokens_mistral': 863, 'n_tokens_neox': 809, 'n_words': 145}