CentOS7下安装MySQL5.7

一、下载MySQL5.7的yum源文件

网址:http://dev.mysql.com/downloads/repo/yum/

[root@me~]# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm

二、安装下载的yum源

[root@me~]# rpm -Uvh mysql57-community-release-el7-7.noarch.rpm

三、yum安装MySQL

[root@me~]# yum install mysql-community-server

mysql5.7安装完成后会初始化一个root用户的默认密码

查找默认密码(当前默认密码是“/(=0RucLq*,I”):

[root@me ~]# grep 'temporary password' /var/log/mysqld.log
2015-11-10T11:57:30.004110Z 1 [Note] A temporary password is generated for root@localhost: /(=0RucLq*,I

四、启动MySQL服务

[root@me~]# service mysqld start

五、执行MySQL的安全配置向导“mysql_secure_installation”命令

执行该命令前必须先启动mysql服务不然提示:

Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' 

[root@me~]# mysql_secure_installation

Securing the MySQL server deployment.

Enter password for user root: <——输入上面安装mysql时初始化的root密码(“/(=0RucLq*,I”

The existing password for the user account root has expired. Please set a new password.<——提示安装mysql时初始化的root密码已过期需要重新设置

New password: <——输入新的root密码(注意:密码至少8位字符,且必须包含大小写和特殊字符,不然在输完重复密码后提示密码不符合要求)

Re-enter new password: <——重复新的root密码

Estimated strength of the password: 100 <——提示密码强度为100

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation go a bit smoother.

You should remove them before moving into a production

environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y<——是否删除匿名用户

Success.

Normally, root should only be allowed to connect from

'localhost'. This ensures that someone cannot guess at

the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y<——是否禁止root远程登录

Success.

By default, MySQL comes with a database named 'test' that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production

environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y<——是否删除test数据库

 - Dropping test database...

Success.

 - Removing privileges on test database...

Success.

Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : 

 ... skipping.

All done!

成功执行完mysql_secure_installation”命令后MySQL5.7就安装成功了


转载于:https://my.oschina.net/u/131720/blog/528747

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值