CentOS-64位安装mysql5.7

本文介绍如何通过Yum Repository安装MySQL 5.7,并提供了详细的步骤指导,包括添加Yum源、安装MySQL服务、启动MySQL服务以及修改默认密码等关键操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.前言

因为直接使用yum install默认安装的版本是5.1,查阅官网后使用Yum Repository安装mysql5.7,这里下载的版本是mysql57-community-release-el6-11.noarch.rpm。

2.安装

1)添加yum repository

[root@localhost opt]# sudo yum localinstall mysql57-community-release-el6-11.noarch.rpm
[root@localhost opt]# yum repolist enabled | grep "mysql.*-community.*"

2)安装mysql

1 [root@localhost /]# sudo yum install mysql-community-server

3)启动mysql及查看服务

1 [root@localhost /]# service mysqld start
2 Initializing MySQL database:                               [  OK  ]
3 Installing validate password plugin:                       [  OK  ]
4 Starting mysqld:                                           [  OK  ]
5 [root@localhost /]# sudo service mysqld status
6 mysqld (pid  42363) is running...

4)修改密码

因mysql有默认密码,先生成临时密码,登录mysql后再修改密码。

1 [root@localhost /]# sudo grep 'temporary password' /var/log/mysqld.log
2 2017-06-27T15:19:54.431342Z 1 [Note] A temporary password is generated for root@localhost: InA1Mppj%R1K

登录mysql

1 [root@localhost /]# mysql -uroot -p
2 Enter password: 

设置密码,mysql密码要求大、小写、数字、特殊字符各一个且长度不能低于八位。

 1 Welcome to the MySQL monitor.  Commands end with ; or \g.
 2 Your MySQL connection id is 4
 3 Server version: 5.7.18
 4 
 5 Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
 6 
 7 Oracle is a registered trademark of Oracle Corporation and/or its
 8 affiliates. Other names may be trademarks of their respective
 9 owners.
10 
11 Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
12 
13 mysql> alter user 'root'@'localhost' identified by 'yourpassword';
14 Query OK, 0 rows affected (0.01 sec)

参考资料:

https://dev.mysql.com/doc/refman/5.7/en/linux-installation-yum-repo.html

https://dev.mysql.com/doc/refman/5.7/en/validate-password-plugin.html

 

转载于:https://www.cnblogs.com/floay/p/7085882.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值