CentOS 7安装Mysql8.0
一、在线yum安装方式
1、下载安装yum Repository
下载地址
https://dev.mysql.com/downloads/repo/yum/
选择Red Hat Enterprise Linux 7下载
2、安装
切换到/usr/local目录,并上传
安装
rpm -ivh mysql80-community-release-el7-3.noarch.rpm
确认mysqlmysql安装版本
yum repolist | grep mysql
---------------------
mysql-connectors-community/x86_64 MySQL Connectors Community 141
mysql-tools-community/x86_64 MySQL Tools Community 105
mysql80-community/x86_64 MySQL 8.0 Community Server 161
安装mysql-community-server
yum install mysql-community-server
等待安装完成
二、安装文件安装
1、下载rpm文件
下载地址
https://dev.mysql.com/downloads/mysql/
操作系统选择
Red Hat Enterprise Linux / Oracle Linux
版本选择
Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit)
2、安装
上传至/usr/local目录下
rpm -ivh mysql-community-server-8.0.19-1.el7.x86_64.rpm
-----------------------------------------
warning: mysql-community-server-8.0.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:mysql-community-client(x86-64) >= 8.0.11 is needed by mysql-community-server-8.0.19-1.el7.x86_64mysql-community-common(x86-64) = 8.0.19-1.el7 is needed by mysql-community-server-8.0.19-1.el7.x86_64
若安装失败,安装相应的依赖
首先安装mysql yum Repository资源
并安装相应依赖
yum install mysql-community-client.x86_64
yum install mysql-community-common.x86_64
三、配置mysql
1、启动mysql并查看状态
systemctl start mysqld.service
systemctl status mysqld.service
------------------------------mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Sat 2020-03-21 16:01:22 CST; 48s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 32228 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 32358 (mysqld)Status: "Server is operational"CGroup: /system.slice/mysqld.service└─32358 /usr/sbin/mysqldMar 21 16:00:50 instance-e7p2g0np systemd[1]: Starting MySQL Server...
Mar 21 16:01:22 instance-e7p2g0np systemd[1]: Started MySQL Server.
2、通过日志文件找出root密码
grep "password" /var/log/mysqld.log
-----------------------------------
2020-03-21T08:01:14.779932Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Xoe09ZF46.=Y
其中root@localhost:后面是密码
3、登录数据库修改密码
mysql -uroot -p
输入密码,登录成功后,此时不能做任何事情,必须修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';
new password是修改的密码,若出现
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
密码设置达不到要求
注意:密码设置必须要有大小写字母加数字加特殊符号,不然不能配置成功
查看密码复杂度
SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+--------+
| Variable_name | Value |
+--------------------------------------+--------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 8 | 长度
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | MEDIUM | 复杂度
| validate_password.special_char_count | 1 |
+--------------------------------------+--------+
修改密码复杂度,和长度
set global validate_password.policy=LOW;
set global validate_password.length=4;
设置成功后,我们可以重新修改密码为123456
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
现在就不会报错
4、配置远程连接
切换到mysql数据库
use mysql
select host,user,authentication_string,plugin from user;
+-----------+------------------+------------------------------------------------------------------------+-----------------------+
| host | user | authentication_string | plugin |
+-----------+------------------+------------------------------------------------------------------------+-----------------------+
| localhost | root | $A$005$&pp53t 'otjkpZ.tUbc9ts9pj5gPelxbJeQb2.ySkmOAEE.pQdgz2V/ | caching_sha2_password |
| localhost | mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
| localhost | mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
| localhost | mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password |
+-----------+------------------+------------------------------------------------------------------------+-----------------------+
我们看root是localhost只能支持本地访问,密码加密方式是caching_sha2_password
这种加密方式客服端连接时连接不上需要修改成 mysql_native_password方式
修改root的host为%
update user set host='%' where user='root';
给root授所有权限
grant all privileges on *.* to 'root'@'%' with grant option;
重新设置密码,并更改加密规则password为新密码
ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
更改密码加密方式为mysql_native_password
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
刷新权限
flush privileges;
重新连接成功
5、修改编码
mysql> status;
--------------
mysql Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)Connection id: 19
Current database: mysql
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 8.0.19 MySQL Community Server - GPL
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /var/lib/mysql/mysql.sock
Binary data as: Hexadecimal
Uptime: 1 hour 7 min 35 secThreads: 4 Questions: 801 Slow queries: 0 Opens: 494 Flush tables: 3 Open tables: 411 Queries per second avg: 0.197
--------------
修改配置文件/etc/my.conf
增加以下配置
character_set_server = utf8
collation-server=utf8_general_ci
重启
service mysqld restart
登录并查询
mysql> show variables like 'character%';
+--------------------------+--------------------------------+
| Variable_name | Value |
+--------------------------+--------------------------------+
| character_set_client | utf8mb4 |
| character_set_connection | utf8mb4 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8mb4 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql-8.0/charsets/ |
+--------------------------+--------------------------------+
8 rows in set (0.01 sec)
CentOS 7安装Mysql8.0相关推荐
- MYSQL再学习2-阿里云服务器Centos安装mysql8.0
上一篇博主已经尝试了测试安装mysql5.7 参考博主上篇链接: CDSN:https://blog.csdn.net/SUBSEA123/article/details/123229957 博客园: ...
- centos 下安装mysql,linux(Centos7)下安装mysql8.0.18的教程图解
1 获取安装资源包 mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar 提取码: rsif 2 在/usr/local目录下新建目录mysql8 3 将下载的资源包(my ...
- CentOS下yum安装MySQL8.0
目录 yum安装MySQL8 安装MySQL8.0资源库 安装MySQL8.0 启动MySQL并配置开机自启 查看默认密码并重置 使用MySQL8.0踩的坑 授权方式改变 无法远程连接 加密规则的改变 ...
- centos6编译安装MYSQL8_CentOS 6.4编译安装MySQL8.0
MySQL 8.0 正式版 8.0.11 已发布,官方表示 MySQL 8 要比 MySQL 5.7 快 2 倍,还带来了大量的改进和更快的性能! 注意:从 MySQL 5.7 升级到 MySQL 8 ...
- CentOS7 源码编译安装MySQL8.0.15 shell脚本
使用MySQL8无需像MySQL5那样需要Boost依赖,和经过35-55分钟的等待编译完成,直接解压即可使用,方便快捷! 1,环境: 操作系统 CentOS Linux release 7.6. ...
- centos8 安装mysql8.0
2019/11/25, CentOS 8, MySQL 8.0 摘要: CentOS 8 安装MySQL 8.0 并配置远程登录 安装MySQL8.0# 使用最新的包管理器安装MySQL sudo d ...
- linux下安装mysql_Linux下安装mysql-8.0.20的教程详解
** Linux下安装mysql-8.0.20 ** 环境介绍 操作系统:CentOS 7 mysql下载地址:https://dev.mysql.com/downloads/mysql/ 下载版本: ...
- mysql8.0.20安装教程linux_Linux下安装mysql-8.0.20的教程详解
** Linux下安装mysql-8.0.20 ** 环境介绍 操作系统:CentOS 7 mysql下载地址:https://dev.mysql.com/downloads/mysql/ 下载版本: ...
- centos7安装Mysql8.0步骤
CentOS7安装mysql8.0步骤 1.1 安装前清理工作: 1.1.1 清理原有的mysql数据库: 使用以下命令查找出安装的mysql软件包和依赖包: rpm -pa | grep mysql ...
最新文章
- mysql hang_mysql夯hang死堆栈采集工具
- R数据可视化 火山图
- iptables 实现地址转换与安全控制
- 大数据文字游戏_基于大数据的游戏化教学系统研究.docx
- Winsock服务器设计的四个关键问题
- 双任务延时原理与空闲任务
- 跟着《架构探险》学轻量级微服务架构 (一)
- MASK LBP代币拍卖共募集近4000万美元
- 关于@PathVariable与@RequestParam
- 功能表单之评星、进度条、颜色选择器的使用——JEPLUS软件快速开发平台
- sort的排序及使用
- Wap Push Access Protocol(PAP)介绍-开放源码
- 2020年MySQL数据库面试题(50道题含答案和思维导图总结)
- IOStream读写文件操作
- 高频电子线路_实验一:调谐放大器
- 微信小程序实战五:人脸识别登录的实现
- 带左右箭头的图片滚动html,js实现图片上显示左右箭头类似翻页效果的代码
- 用友软件计算机时间格式,如何正确设置系统日期格式?_速达软件_用友,速达,管家婆,微软,金蝶,方正,博世通,数据博士,进销存,财务软件-飞鸿软件帮助中心 -...
- RefSeq Protein Accession转换为蛋白质(YP_009227197转换成Protein)
- 编程题:核桃的数量(求最小公倍数的问题)