请选择 进入手机版 | 继续访问电脑版

yum安装Mysql5.7

[复制链接]
查看944 | 回复0 | 2019-10-1 11:01:20 | 显示全部楼层 |阅读模式
一、环境

CentOS 7


二、安装方法

下载mysql源
# wget http://repo.mysql.com/mysql57-community-release-el7.rpm
(如果要安装其他版本的mysql,可以去 http://repo.mysql.com/ 下面查找其他版本的mysql)

安装mysql源
# rpm -ivh mysql57-community-release-el7.rpm
安装mysql
# yum -y install mysql-server

初始化
# mysqld --initialize

更改权限
# chown mysql:mysql -R /var/lib/mysql
启动mysql
# systemctl start mysqld

查看mysql的初始密码:
# cat /var/log/mysqld.log | more
输出如下信息:

2019-09-30T05:40:22.509078Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more
details).
2019-09-30T05:40:23.469272Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-09-30T05:40:23.612211Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-09-30T05:40:23.682552Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: cc53a31c
-e344-11e9-996e-fa163ec17f3f.
2019-09-30T05:40:23.685257Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-09-30T05:40:23.685875Z 1 [Note] A temporary password is generated for root@localhost: 4x)KhhOikl4V

从最后一行可以看出,mysql的初始密码是 4x)KhhOikl4V

用初始密码登陆mysql:
# mysql -u root -p

登陆mysql后,可以修改初始密码。修改初始密码的方法参考以下链接:
https://www.51anidea.com/forum.php?mod=viewthread&tid=1405




上一篇:安装mysql5.7报错:[ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
下一篇:mysql5.7安装好了 密码是什么?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1249

主题

2736

帖子

7万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
70233
QQ