centos7下使用yum安装mysql 8

阅读数:151 评论数:0

跳转到新版页面

分类

数据库

正文

Centos7的yum源中没有mysql,为了解决这个问题,我们需要先下载mysql的repo源。

一、下载mysql的repo源并安装

wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
rpm -ivh mysql80-community-release-el7-1.noarch.rpm

二、安装mysql

yum install mysql-server

如果提示“请检查源的公钥URL是否配置正确”

改为

yum install mysql-server --nogpgcheck

启动mysql

systemctl start mysqld.service

三、密码配置

新版本的mysql会为root用户创建一个初始密码,需要更改。

查看默认密码:

grep 'temporary password' /var/log/mysqld.log

使用该密码登录:

mysql -uroot -p

更改密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';

注意:默认的密码加密方式是caching_sha2_password,而现在很多客户端工具还不支持这种加密方式

四、数据库授权

数据库没有授权,只支持localhost本地访问。

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

重启数据库

systemctl restart mysqld.service

五、开机自启动

systemctl enable mysqld.service

systemctl daemon-reload

六、启动、关闭命令

systemctl start mysqld.service 启动

systemctl stop mysqld.service 关闭

systemctl restart mysqld.service 重启

systemctl status mysqld.service 查看服务状态

七、其它问题

1、1820 you must reset your password using...

这是提示你要用alter user修改密码后才可以使用。

alter user 'root'@'localhost' identified by '你的密码';



相关推荐

如果主库已经投入使用了,此时如果需要主从同步,需要导出所表结构和数据,然后导入到从库中。这时需要注意修改/var/lib/mysql/auto.cnf中uuid。 master配

一、概述 二、JSON字段的增删改查 1、插入操作 (1)可以直接插入json格式的字符串。 mysql> create table t(c1 json); Query OK, 0 rows affe

备份的类型 1、根据是否需要数据库离线 (1)冷备: 需要关mysql服务,请写请求均不允许 (2)温备: 服务在线,但仅支持读请求。 <p

一、事务的ACID 1、Atomicity原子性 Transactions are often composed of multiple statements. Atomicity guarantee

一、登录mysql mysql --version -查看Mysql版本 mysql -h hostname -u username -p -h:运行mysql服务器的机器,如果正在该机器上运行此命令

mysql的权限分为4级:全局、数据库、表、列。 1、grant grant privileges [

insert [into] table [(column1,column2,column3,...)] values (val

一、语法 select [optioins] items [into file_details] from tables [where conditions] [group by gr

一、语法 update [low_priority] [ignore] tablename set column1=expression1,... [where condition] [order b

一、语法 1、基本语法 alter table [ignore] tablename alteration [,alteration...] (1)ignore,如果会导致唯一键重复,则这些操作将自动