MySQL 8.0.11安装配置

官网地址: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_secure_installation的安装说明。

因此这里使用推荐的RPM安装:

一、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 <包名>即可)

[[email protected] ~]# rpm -ivh mysql-community-common-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-common-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-common ########################################### [100%]
[[email protected] ~]# rpm -ivh mysql-community-libs-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-libs-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-libs   ########################################### [100%]
[[email protected] ~]# rpm -ivh mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
	file /usr/lib64/mysql/libmysqlclient.so.16.0.0 from install of mysql-community-libs-compat-8.0.11-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-8.0.1.el6_8.x86_64
	file /usr/lib64/mysql/libmysqlclient_r.so.16.0.0 from install of mysql-community-libs-compat-8.0.11-1.el6.x86_64 conflicts with file from package mysql-libs-5.1.73-8.0.1.el6_8.x86_64
[[email protected] ~]# rpm -e --nodeps mysql-libs-5.1.73-8.0.1.el6_8.x86_64
[[email protected] ~]# rpm -ivh mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-libs-compat-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-libs-co########################################### [100%]
[[email protected] ~]# rpm -ivh mysql-community-server-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-server-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	mysql-community-client(x86-64) >= 8.0.0 is needed by mysql-community-server-8.0.11-1.el6.x86_64
[[email protected] ~]# rpm -ivh mysql-community-client-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-client-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-client ########################################### [100%]
[[email protected] ~]# rpm -ivh mysql-community-server-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-server-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-server ########################################### [100%]
[[email protected] ~]# rpm -ivh mysql-community-devel-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-devel-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:mysql-community-devel  ########################################### [100%]
^[[A[[email protected] ~]# rpm -ivh mysql-community-test-8.0.11-1.el6.x86_64.rpm
warning: mysql-community-test-8.0.11-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
	perl(JSON) is needed by mysql-community-test-8.0.11-1.el6.x86_64
--懒的去装perl了,因此测试套件就不装了。

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

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

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

[[email protected] ~]# service mysqld start
Initializing MySQL database:                               [  OK  ]
Starting mysqld:                                           [  OK  ]

四、发现没密码不能登录,于是添加skip-grant-tables到my.cnf,重启进去重置密码

mysql> alter user [email protected]‘localhost‘ identified by ‘mysql‘;
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> exit
Bye

居然不能改。。。于是:

mysql> delete from mysql.user where user=‘root‘;
Query OK, 1 row affected (0.10 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> create user [email protected]‘localhost‘ identified by ‘mysql‘;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

还是不能改,查看密码复杂度要求:

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)

于是继续创建用户,MySQL8.0取消了直接grant创建用户的语法,只能先create user再grant,因此创建root如下:

mysql> create user [email protected]‘localhost‘ identified by ‘mysql‘;
ERROR 1396 (HY000): Operation CREATE USER failed for ‘root‘@‘localhost‘

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

mysql> create user [email protected]‘localhost‘ identified by ‘mysql‘;
ERROR 1396 (HY000): Operation CREATE USER failed for ‘root‘@‘localhost‘

尼玛...什么玩意儿?

于是去逛了一圈stackoverflow,都说这是一个BUG,于是操作如下:

mysql> drop user [email protected]‘localhost‘;   --是的没错,虽然没有[email protected]‘localhost‘用户,但你还是要删一遍。
Query OK, 0 rows affected (0.05 sec)

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

mysql> create user [email protected]‘localhost‘ identified by ‘mysql‘;
Query OK, 0 rows affected (0.03 sec)

mysql> grant all on *.* to [email protected]‘localhost‘ with grant option;
Query OK, 0 rows affected (0.03 sec)

终于改完密码了...去掉参数文件的skip-grant-tables参数,service mysqld restart重启服务。

原文地址:https://www.cnblogs.com/leohahah/p/9044904.html

时间: 2024-11-06 02:12:06

MySQL 8.0.11安装配置的相关文章

MySQL.8.0.11安装

1.参考:MySQL-mysql 8.0.11安装教程 - Laumians - 博客园.html(http://www.cnblogs.com/laumians-notes/p/9069498.html) 2. 3. 4. 5. 原文地址:https://www.cnblogs.com/dbskill/p/10401744.html

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

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

如何在Ubuntu Linux上安装 MySQL 8.0.11

继MySQL 5.7之后,直接跳到了MySQL 8.0,官方说这次来了个大升级,其他的不说,就访问速度是5.7的2倍,因此我也尝试安装使用,根据官方文档,下面是安装的过程 一.工具 Ubuntu 16.04 MySQL Community Server 8.0.11 二.安装过程 1. 下载安装包 选择的是Linux 64位通用的二级制版本,这样不在需要进行编译安装,系统安装依赖库后就可以直接使用. 2. 安装依赖库 官方说要安装libaio,但实际如果你安装libaio库的话不行,还需安装nu

PHP 5.5.38 + mysql 5.0.11 + zabbix3.0 + nginx 安装

PHP 5.5.38 + mysql 5.0.11 + zabbix3.0 + nginx 1.首先在安装好环境下安装 zabbix3.0情况下 2. yum install mysql-devel net-snmp-devel curl curl-devel -y groupadd zabbixuseradd -g zabbix zabbix 3. wget -c http://ncu.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20De

MySQL 8.0.11 GA版二进制安装

MySQL 8.0.11已发布,听闻性能提升两倍,今个自己安装体验下.1.卸载mysql老版本rpm -qa|grep mysql或者mairadbrpm -e mysql*/mariadb*rpm -e --nodeps mysql*/mariadb* 2.安装依赖包yum install gcc gcc-c++ libaio 3.下载软件包并解压tar -zxf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz -C /opt/mysql 4.创建软连接 

CentOS7 下源码安装MySQL 8.0.11

CentOS7 下源码安装MySQL 8.0.11 系统环境:CentOS7, 内核:Linux 3.10.0-862.el7.x86_64 如果有旧版本的MySQL,先卸载,用下面命令来查询出系统有哪些相关的MySQL包. rpm -qa | grep mysql 如果上述命令查询出有相关的MySQL包,就卸载 rpm -e 包名 卸载MariaDB包 yum remove mariadb-libs.x86_64 从MySQL官网下载源码包,并将该文件拷贝到系统中. https://dev.m

原创:mysql5 还原至mysql 8.0.11数据库链接配置提示错误改动备注

原创:mysql5 还原至mysql 8.0.11数据库链接配置提示错误改有三: a) mysql 连接jar包版修改 b)类路径修改 c)配置连接池地址修改 因版本升级,首先要修改 1:mysql-connector-java 架包版本修改 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> !--原版本 5.1.6-->

mysql 8.0.11 二进制安装

#!/bin/bash ## 2018-5-24 ## hequan mkdir -p /data/src/ cd /data/src/ if [ ! -f mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz ]; then wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz fi yum install -y numactl.x86

MYSQL + MHA +keepalive + VIP安装配置(三)--keepalived安装配置

一.概述 keepalived介绍:Keepalived的作用是检测web服务器的状态,如果有一台web服务器死机,或工作出现故障,Keepalived将检测到,并将有故障的web 服务器从系统中剔除,当web服务器工作正常后Keepalived自动将web服务器加入到服务器群中,这些工作全部自动完成,不需要人工干涉,需要人 工做的只是修复故障的web服务器. 二.环境 ? 1 2 3 vip:192.168.1.203\204 mysql-master:192.168.1.231 mysql-