Centos 7 安装Mysql

如果在centos 7 使用yum -y install mysql-server

安装的的是

mariadb-devel-5.5.56-2.el7.x86_64
mariadb-5.5.56-2.el7.x86_64
mariadb-libs-5.5.56-2.el7.x86_64

得不到需要的mysql社区版.

所以需要按以下方法安装:

1.下载并安装msyql的yum源,并检查是否安装成功

wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
yum localinstall mysql57-community-release-el7-8.noarch.rpm

yum repolist enabled | grep “mysql.*-community.*”

2.编辑yum源,如果需要安装5.6的版本需要在enable=0处改1,5.7的改01

vim /etc/yum.repos.d/mysql-community.repo

3.安装社区版mysql
yum install mysql-community-server

4.启动服务

service mysqld start

5.配置默认编码和监听
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
bind-address=0.0.0.0
port=33060

6.开机启动

systemctl enable mysqld
systemctl daemon-reload

7.获取初始密码

grep ‘temporary password’ /var/log/mysqld.log

修改root默认密码
shell> mysql -uroot -p
mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘MyNewPass4!’;

然后就是熟悉的界面了.

赞(0)
未经允许不得转载:http://www.yueguangzu.net逗逗网 » Centos 7 安装Mysql
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址