Mysql8.0 安装手册(linux)

目录

 

添加Mysql的 yum 仓库.

安装mysql

开启远程访问


添加Mysql的 yum 仓库.

访问 https://dev.mysql.com/downloads/repo/yum/ 下载 yum 源

点击 download

复制下载链接使用 wget  下载

[root@VM_121_116_centos ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm

安装刚刚下载的包

[root@VM_121_116_centos ~]# rpm -Uvh mysql80-community-release-el7-2.noarch.rpm 

查看mysql yum源

[root@VM_121_116_centos ~]# yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community   disabled
mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - disabled
mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community   disabled
mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - disabled
mysql-connectors-community/x86_64  MySQL Connectors Community    enabled:     95
mysql-connectors-community-source  MySQL Connectors Community -  disabled
mysql-tools-community/x86_64       MySQL Tools Community         enabled:     84
mysql-tools-community-source       MySQL Tools Community - Sourc disabled
mysql-tools-preview/x86_64         MySQL Tools Preview           disabled
mysql-tools-preview-source         MySQL Tools Preview - Source  disabled
mysql55-community/x86_64           MySQL 5.5 Community Server    disabled
mysql55-community-source           MySQL 5.5 Community Server -  disabled
mysql56-community/x86_64           MySQL 5.6 Community Server    disabled
mysql56-community-source           MySQL 5.6 Community Server -  disabled
mysql57-community/x86_64           MySQL 5.7 Community Server    disabled
mysql57-community-source           MySQL 5.7 Community Server -  disabled
mysql80-community/x86_64           MySQL 8.0 Community Server    enabled:     82
mysql80-community-source           MySQL 8.0 Community Server -  disabled
[root@VM_121_116_centos ~]# 

看到除了刚刚的 mysql80-community/x86_64 是启用的其余都是未启用, 

如果不是这样的话, 就要吧 80 改成启用, 其余改成未启用操作命令如下: 

 yum-config-manager --enable mysql80-community
yum-config-manager --disable mysql57-community

安装mysql

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

输入 y

继续输入 y

启动mysql

[root@VM_121_116_centos ~]# systemctl start mysqld

查看数据库的 root的密码  

[root@VM_121_116_centos ~]# grep 'temporary password' /var/log/mysqld.log

登入mysql 数据库修改root 密码, 执行命令输入刚刚查看的密码

[root@VM_121_116_centos ~]# mysql -uroot -p

修改密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'QQ123qaz!';
Query OK, 0 rows affected (0.04 sec)

开启远程访问

查看root用户

mysql> select user,authentication_string,host from user;
+------------------+------------------------------------------------------------------------+-----------+
| user             | authentication_string                                                  | host      |
+------------------+------------------------------------------------------------------------+-----------+
| mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | localhost |
| mysql.session    | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | localhost |
| mysql.sys        | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | localhost |
| root             | $A$005$E0<(tf.mL	;CV&43huognIaXeaqXKwlPTEzNCBW5ZHZaM6p3T/9yX5GPffK1 | localhost |
+------------------+------------------------------------------------------------------------+-----------+
4 rows in set (0.00 sec)

更新root的 host 为 '%', 并且刷新权限

mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值