官网地址:https://dev.mysql.com/downloads/mysql/

我这里是RHEL6.5的系统,因此选择RedHat 6 x86,64bit操作系统---下载第一个RPM Bundle即可--mysql-8.0.11-1.el6.x86_64.rpm-bundle.tar。

目前MySQL8.0.11社区版提供了多种多样的安装方式,你也可以通过下载Linux Generic安装包mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz来安装,这种安装方式无需考虑包兼容性,本文只描述rpm安装方式。

wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-1.el6.x86_64.rpm-bundle.tar

如果上述链接失效,一般是因为官网已经更新了新版本,找到最新版本的版本号修改下载即可。

一、mysql-8.0.11-1.el6.x86_64.rpm-bundle.tar解压后有如下7个文件:

-rw-r--r-- 1 root root  28987588 Apr  9 01:06 mysql-community-client-8.0.11-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 672184 Apr 9 01:06 mysql-community-common-8.0.11-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 4443296 Apr 9 01:06 mysql-community-devel-8.0.11-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 2579460 Apr 9 01:06 mysql-community-libs-8.0.11-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 1902676 Apr 9 01:06 mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 395918848 Apr 9 01:07 mysql-community-server-8.0.11-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 49092596 Apr 9 01:07 mysql-community-test-8.0.11-1.el6.x86_64.rpm

然后创建mysql用户:

useradd mysql
passwd mysql

二、安装顺序为:(强烈建议装之前先把之前的或自带的mysql相关包全部卸载,rpm -e --nodeps <包名>即可)

rpm -ivh mysql-community-common-8.0.11-1.el6.x86_64.rpm \
mysql-community-libs-8.0.11-1.el6.x86_64.rpm \
mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm \
mysql-community-client-8.0.11-1.el6.x86_64.rpm \
mysql-community-server-8.0.11-1.el6.x86_64.rpm \
mysql-community-devel-8.0.11-1.el6.x86_64.rpm

三、安装完毕后相关信息如下:

[root@python ~]# mysql -V
mysql Ver 8.0.11 for Linux on x86_64 (MySQL Community Server - GPL)
[root@python ~]# ll /etc/init.d/mysqld
-rwxr-xr-x 1 root root 7166 Apr 8 16:21 /etc/init.d/mysqld
[root@python ~]# ll /etc/my.cnf --配置文件位置
-rw-r--r-- 1 root root 1188 Apr 8 16:21 /etc/my.cnf

默认的datadir是在/var/lib/mysql/,可以通过修改my.cnf修改,启动命令如下:

[root@python ~]# service mysqld start
Initializing MySQL database: [ OK ]
Starting mysqld: [ OK ]

四、使用默认密码登录MySQL

在安装完后,/var/log/mysqld.log里应该含有临时的root密码,可以直接登录,你可以将此root密码更改为自己更熟悉的密码。

mysql> alter user root@'localhost' identified by 'mysql';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

这里存在密码复杂度要求(在Windows平台使用msi安装mysql时,则有自主选择密码认证方式的步骤,可以比较方便的进行设置。):

mysql> show variables like '%pass%';
+----------------------------------------------+-----------------+
| Variable_name | Value |
+----------------------------------------------+-----------------+
| caching_sha2_password_auto_generate_rsa_keys | ON |
| caching_sha2_password_private_key_path | private_key.pem |
| caching_sha2_password_public_key_path | public_key.pem |
| default_password_lifetime | 0 |
| disconnect_on_expired_password | ON |
| mysql_native_password_proxy_users | OFF |
| password_history | 0 |
| password_reuse_interval | 0 |
| report_password | |
| sha256_password_auto_generate_rsa_keys | ON |
| sha256_password_private_key_path | private_key.pem |
| sha256_password_proxy_users | OFF |
| sha256_password_public_key_path | public_key.pem |
| 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 |
+----------------------------------------------+-----------------+

查看官网https://dev.mysql.com/doc/refman/8.0/en/validate-password-options-variables.html#sysvar_validate_password.policy

发现此值有3个,如下所示:

于是设置为0,然后将validate_password.length设置为4,表示最少需要4字符。之所以设置为4是因为这个参数的值不能小于如下公式的计算结果:

validate_password.number_count
+ validate_password.special_char_count
+ (2 * validate_password.mixed_case_count)

五、建一个测试用户leo,尝试远程连接下吧:

$ mysql -uleo -pmysql -h192.168.1.193
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

我这5.7的mysql工具都连不上,这就尴尬了,查看认证相关参数:

mysql> show variables like '%auth%';
+-------------------------------+-----------------------+
| Variable_name | Value |
+-------------------------------+-----------------------+
| default_authentication_plugin | caching_sha2_password |
+-------------------------------+-----------------------+
1 row in set (0.02 sec)

查看官网发现此值的取值如下:

官网还说此值影响create user不显式指定auth plugin时密码的默认加密算法,这意味着低版本的mysql工具基本连不上8.0,简单起见我们直接使用以前的加密算法。

mysql> select user,host,plugin from mysql.user;
+------------------+-----------+-----------------------+
| user | host | plugin |
+------------------+-----------+-----------------------+
| leo | % | caching_sha2_password |
| mysql.infoschema | localhost | mysql_native_password |
| mysql.session | localhost | mysql_native_password |
| mysql.sys | localhost | mysql_native_password |
| root | localhost | caching_sha2_password |
+------------------+-----------+-----------------------+

在my.cnf里添加:default_authentication_plugin=mysql_native_password,然后service mysqld restart重启服务,以下只演示leo用户的创建:

mysql> drop user leo;
Query OK, 0 rows affected (0.10 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> create user leo identified by 'mysql';
Query OK, 0 rows affected (0.02 sec)
mysql> grant all on *.* to leo;
Query OK, 0 rows affected (0.08 sec)
$mysql -V
mysql Ver 14.14 Distrib 5.7.20, for Linux (x86_64) using EditLine wrapper
$ mysql -uleo -pmysql -h192.168.1.193
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.11 MySQL Community Server - GPL Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

至此远程连接正常。

MySQL 8.0.11安装配置的更多相关文章

  1. mysql 5.0.46安装配置

    http://os.chinaunix.net/a2008/0801/986/000000986346.shtml RPM包和源码包存放位置 /usr/local/src 源码包编译安装位置(pref ...

  2. mysql 8.0.11 安装(windows)

    mysql本地安装(windows) 一.安装包下载 从官网下载安装包,地址:https://dev.mysql.com/downloads/mysql/ 二.配置 解压到本地,然后在目录下新建my. ...

  3. MYSQL 8.0.11 安装过程及 Navicat 链接时遇到的问题

    参考博客:https://blog.csdn.net/WinstonLau/article/details/78666423 我的系统和软件版本是这样的: 系统环境:win7.64位 MySQL版本: ...

  4. mysql 8.0.11安装教程

    安装环境:win7 1. 下载安装包 下载地址:https://dev.mysql.com/downloads/file/?id=476233 2. 解压zip包 3. 初始化my.ini 创建my. ...

  5. mysql 8.0.17 安装配置方法图文教程

    1.URL:https://www.jb51.net/article/167782.htm 2.装好之后需要使用add user中的用户名和密码登录(之前安装数据库时出现的) 使用navicat连接时 ...

  6. mysql 8.0.12 安装配置方法图文教程

    一.安装 1.从网上下载MySQL8.0.12版本,下载地址 2. 下载完成后解压 我解压的路径是:D:\Java\mysql-8.0.12-winx64 3. 配置文件 首先在解压的路径下查看是否含 ...

  7. Windows10下mysql 8.0.19 安装配置方法图文教程

    第一步 下载安装包: 官网 毕竟是甲骨文公司的产品,去官网下真的慢! 这里有两个供选择的,我建议选第一个(因为我先下了第二个,结果失败了,不知道为什么总是出错.) 下载完自行选择路径解压就可以了. 第 ...

  8. SQLyog 报错2058 :连接 mysql 8.0.11 解决方法

    下载新版的 mysql 8.0.11 安装. 为了方便安装查看,我下载了sqlyog 工具 连接 mysql 配置新连接报错:错误号码 2058,分析是 mysql 密码加密方法变了. 解决方法:wi ...

  9. MySQL 8.0.11(zip)安装及配置

    (1)下载MySQL8.0.11: (2)解压zip文件: 我解压到了D:/MySQL/mysql-8.0.11-winx64 (3)配置环境变量:   右键此电脑->属性 高级系统设置 环境变 ...

随机推荐

  1. SpringCloud学习6-如何创建一个服务消费者consumer

    上一节如何创建一个服务提供者provider已经启动了一个provider的server,提供用户信息查询接口.接下来,我们启动另一个provider,由于是同一台机器本地测试,我们换一个端口 --s ...

  2. 在ASP.NET Core 2.2 中创建 Web API并结合Swagger

    一.创建 ASP.NET Core WebApi项目 二.添加 三. ----------------------------------------------------------- 一.创建项 ...

  3. pip/pip3更换国内源

    pip/pip3更换国内源 用途:pip更换为国内源,可以大大的提高安装成功率和速度. Windows更换pip/pip3源 打开目录:%appdata% 新增pip文件夹,新建pip.ini文件 给 ...

  4. LeetCode每天一题之两数之和

    这个LeetCode刷题系列的博客权当是为自己记一下笔记吧.博客系列会从LeetCode的第一题开始刷,同时会从零开始学习[因为我就是零/(ㄒoㄒ)/~~].同时,如果有写错的地方,希望大佬们在评论区 ...

  5. 03_SQL server数据类型

    SQL server数据类型 String类型: 数据类型: 描述 存储 char(n) 固定长度的字符串.最多 8,000 个字符.定义类型为char(5),那么就表示该类型可以存储5个字符,即使存 ...

  6. μC/OS-II 中的任务管理

    1. 任务的状态及其转换 睡眠状态: 任务在没有被配备任务控制块或被剥夺了任务控制块时的状态叫做任务的睡眠状态. 等待状态: 正在运行的任务,需要等待一段时间或需要等待一个事件发生再运行时,该任务就会 ...

  7. Python系列:二、数据类型--技术流ken

    标准数据类型 Python3 中有六个标准的数据类型: Number(数字) String(字符串) List(列表) Tuple(元组) Set(集合) Dictionary(字典) Python3 ...

  8. 收官之作:利用Microsoft Teams构建中大型社区的技术架构与运营经验

    这是我在 精彩又一年:Microsoft Teams技术社区2018年度回顾和展望 活动上面的主题分享,我用Microsoft Teams技术社区的实践经验,给大家整理和分享了技术架构和一些运营经验. ...

  9. mysql创建和调用out参数的存储过程

    CREATE PROCEDURE sp_add(a int, b int,out c int) begin set c=a+ b; end; 调用过程: call sp_add (,,@a); sel ...

  10. [PHP]算法-二进制中1的个数的PHP实现

    二进制中1的个数: 输入一个整数,输出该数二进制表示中1的个数.其中负数用补码表示. 思路: 1.右移位运算>> 和 与运算& 2.先移位个然后再与1 &运算为1的就是1 ...