主要参考博文:

http://www.cnblogs.com/lzj0218/p/5724446.html

http://www.cnblogs.com/zqifa/p/linux-mysql-1.html


网上各种安装教程满天飞,很少有参照一家能成功的,为神马。。。。 合百家之长,整理一个最简单的,嘻嘻。


1.检测系统是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步使用yum安装时会报错:

1 # yum list installed | grep mysql
2 mysql-libs.i686         5.1.71-1.el6      @anaconda-CentOS-201311271240.i386/6.5
3 # yum -y remove mysql-libs.i686

 

2.从mysql的官网下载mysql57-community-release-el6-5.noarch.rpm(注意这里的el6-5即适配RHEL6.5的版本,如果下载了其它版本后面的安装过程中可能会报错):

wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

 

3.安装第一步下载的rpm文件:

 yum install mysql-community-release-el6-5.noarch.rpm

安装成功后,我们可以看到/etc/yum.repos.d/目录下增加了以下两个文件

1 # ls /etc/yum.repos.d
2 mysql-community-source.repo
3 mysql-community.repo

自行修改配置文件(/etc/yum.repos.d/mysql-community.repo)使mysql57下面的enable=1

CentOS6.5 安装 MySQL5.7 笔记


继续。。。

1 # yum repolist enabled | grep mysql
2 mysql-connectors-community MySQL Connectors Community                        13
3 mysql-tools-community      MySQL Tools Community                             18
4 mysql57-community-dmr      MySQL 5.7 Community Server Development Milesto    65

 

4.使用yum安装mysql:

yum install mysql-community-server

 

5.启动mysql服务:

service mysqld start

查看root密码:

1 # grep "password" /var/log/mysqld.log
2 2016-08-10T15:03:02.210317Z 1 [Note] A temporary password is generated for [email protected]: AYB(&-3Cz-rW

现在必须立刻修改密码,不然会报错:

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

6.修改密码:

mysql_secure_installation

## 输出
Securing the MySQL server deployment.

Enter password for user root: [请在这里输出自动生成的密码,如:s8)9B9)!#iWJ]
## 注:密码必须满足1)长度大于8;2)包含至少1个数字,1个大写字母,1个小写字母,1个非字母数字的符号;3)长度不得超过32位。
## 完成后还需要设置一些初始化的配置,请按照提示来做

# 以上步骤结束后,可以使用root用户登录mysql试试了
shell> mysql -u root -p

7.授权远程登录:

登录后use mysql;

select host,user from user;

CentOS6.5 安装 MySQL5.7 笔记


更改允许远程连接:

update user  set host ='%' where user='root';

CentOS6.5 安装 MySQL5.7 笔记



8.查看mysqld是否开机自启动,并设置为开机自启动:

1 chkconfig --list | grep mysqld
2 chkconfig mysqld on

 

9.修改字符集为UTF-8:

vim /etc/my.cnf

在[mysqld]部分添加:

character-set-server=utf8

在文件末尾新增[client]段,并在[client]段添加:

default-character-set=utf8

修改好之后重启mysqld服务:

service mysqld restart     



收工咯~~~~~~~

相关文章:

  • 2021-11-21
  • 2021-10-03
  • 2021-08-30
  • 2021-12-29
  • 2022-01-13
  • 2021-07-13
  • 2021-09-03
猜你喜欢
  • 2021-11-05
  • 2021-10-22
  • 2018-12-10
  • 2021-08-03
  • 2021-11-20
  • 2022-01-17
相关资源
相似解决方案