Linux下的 Mysql 8.0 yum 安装 并修改密码
1.MySQL版本:
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.18 |
+-----------+
1 row in set (0.00 sec)2.Centos操作系统版本
[root@Hadoop-00 /]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
二、Mysql现在以及解压
1. 地址:https://downloads.mysql.com/archives/community/
2.linux中下载
1.在命令中输入这个语句,获取 mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar:
wget https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar
2.解压:
tar -xvf mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 root root 684851200 9月 23 15:36 mysql-8.0.18-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 7155 31415 40104640 9月 23 15:19 mysql-community-client-8.0.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 611436 9月 23 15:20 mysql-community-common-8.0.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 6915400 9月 23 15:20 mysql-community-devel-8.0.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 23683600 9月 23 15:20 mysql-community-embedded-compat-8.0.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 3877664 9月 23 15:20 mysql-community-libs-8.0.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 1363968 9月 23 15:20 mysql-community-libs-compat-8.0.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 450282440 9月 23 15:21 mysql-community-server-8.0.18-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 158001648 9月 23 15:22 mysql-community-test-8.0.18-1.el7.x86_64.rpm
三、安装
1. 卸载系统自带的mariadb-lib
查看mariadb版本
rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64卸载mariadb
rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
2.安装依赖环境
yum install -y openssl-devel.x86_64 openssl.x86_64
yum install -y libaio.x86_64 libaio-devel.x86_64
yum install -y perl.x86_64 perl-devel.x86_64
yum install -y perl-JSON.noarch
yum install -y autoconf
yum install -y wget
yum install -y net-tools
3.关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
4.禁用selinux
vi /etc/selinux/config
将SELINUX=enforcing
改为SELINUX=disabled
reboot
重启机器
5.安装
/** 必须按顺序装,防止出现未知的问题 */ rpm -ivh mysql-community-common-8.0.-.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.-.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.-.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.-.el7.x86_64.rpm -------------------------------------------------------------------------------- rpm -ivh mysql-community-libs-compat-8.0.-.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-compat-8.0.-.el7.x86_64.rpm
rpm -ivh mysql-community-devel-8.0.-.el7.x86_64.rpm
rpm -ivh mysql-community-test-8.0.-.el7.x86_64.rpm --初始化数据库
mysqld --initialize --console
--目录授权,否则启动失败
chown -R mysql:mysql /var/lib/mysql/
--启动服务
systemctl start mysqld
6.登陆密码设置
//报错
ERROR (HY000): Can't connect to MySQL server on 'localhost' (111) '
1)更改配置,此处可以跳过密码设置
vi /etc/my.cnf
#在mysqld模块下添加
skip-grant-tables
// password 函数在MySQL8中位置,以下步骤未实现
2)重启服务:
systemctl restart mysqld
3) 按照传统改密码方式发现没有 password这个字段。
mysql> update user set password=password('123') where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
网上查了一下据说5.7 版本password 字段改成authentication_string password函数未知
mysql> update user set authentication_string=password('123') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
user 表的管理字段
+--------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host | char(255) | NO | PRI | | |
| User | char(32) | NO | PRI | | |
| Select_priv | enum('N','Y') | NO | | N | |
| Insert_priv | enum('N','Y') | NO | | N | |
| Update_priv | enum('N','Y') | NO | | N | |
| Delete_priv | enum('N','Y') | NO | | N | |
| Create_priv | enum('N','Y') | NO | | N | |
| Drop_priv | enum('N','Y') | NO | | N | |
| Reload_priv | enum('N','Y') | NO | | N | |
| Shutdown_priv | enum('N','Y') | NO | | N | |
| Process_priv | enum('N','Y') | NO | | N | |
| File_priv | enum('N','Y') | NO | | N | |
| Grant_priv | enum('N','Y') | NO | | N | |
| References_priv | enum('N','Y') | NO | | N | |
| Index_priv | enum('N','Y') | NO | | N | |
| Alter_priv | enum('N','Y') | NO | | N | |
| Show_db_priv | enum('N','Y') | NO | | N | |
| Super_priv | enum('N','Y') | NO | | N | |
| Create_tmp_table_priv | enum('N','Y') | NO | | N | |
| Lock_tables_priv | enum('N','Y') | NO | | N | |
| Execute_priv | enum('N','Y') | NO | | N | |
| Repl_slave_priv | enum('N','Y') | NO | | N | |
| Repl_client_priv | enum('N','Y') | NO | | N | |
| Create_view_priv | enum('N','Y') | NO | | N | |
| Show_view_priv | enum('N','Y') | NO | | N | |
| Create_routine_priv | enum('N','Y') | NO | | N | |
| Alter_routine_priv | enum('N','Y') | NO | | N | |
| Create_user_priv | enum('N','Y') | NO | | N | |
| Event_priv | enum('N','Y') | NO | | N | |
| Trigger_priv | enum('N','Y') | NO | | N | |
| Create_tablespace_priv | enum('N','Y') | NO | | N | |
| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
| max_questions | int(11) unsigned | NO | | 0 | |
| max_updates | int(11) unsigned | NO | | 0 | |
| max_connections | int(11) unsigned | NO | | 0 | |
| max_user_connections | int(11) unsigned | NO | | 0 | |
| plugin | char(64) | NO | | caching_sha2_password | |
| authentication_string | text | YES | | NULL | |
| password_expired | enum('N','Y') | NO | | N | |
| password_last_changed | timestamp | YES | | NULL | |
| password_lifetime | smallint(5) unsigned | YES | | NULL | |
| account_locked | enum('N','Y') | NO | | N | |
| Create_role_priv | enum('N','Y') | NO | | N | |
| Drop_role_priv | enum('N','Y') | NO | | N | |
| Password_reuse_history | smallint(5) unsigned | YES | | NULL | |
| Password_reuse_time | smallint(5) unsigned | YES | | NULL | |
| Password_require_current | enum('N','Y') | YES | | NULL | |
| User_attributes | json | YES | | NULL | |
+--------------------------+-----------------------------------+------+-----+-----------------------+-------+
51 rows in set (0.01 sec)
4.更改配置重启
[root@master1 ~]# vi /etc/my.cnf
注释 # skip-grant-tables
[root@master1 ~]# systemctl restart mysqld
[root@master1 ~]# mysql -uroot -p123
5.成功:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.18 MySQL Community Server - GPL
Copyright (c) 2000, 2019, 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>
7.其他
[root@Hadoop- log]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@Hadoop- log]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since 二 -- :: CST; 2s ago
Docs: man:mysqld()
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=/SUCCESS)
Main PID: (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─ /usr/sbin/mysqld 2月 :: Hadoop- systemd[]: Starting MySQL Server...
2月 :: Hadoop- systemd[]: Started MySQL Server.
2. 如果安装过程出现操作失误问题,卸载MySQL重新开始
yum remove mysql-community-client.x86_64
yum remove mysql-community-common.x86_64
yum remove mysql-community-devel.x86_64
yum remove mysql-community-embedded-compat.x86_64
yum remove mysql-community-libs.x86_64
yum remove mysql-community-libs-compat.x86_64
yum remove mysql-community-server.x86_64
yum remove mysql-community-test.x86_64
yum remove mysql57-community-release.noarch
------------------------------------------------------------------------
rm -rf /etc/rc.d/init.d/mysql
rm -rf /etc/selinux/targeted/active/modules/100/mysql
rm -rf /usr/share/mysql
rm -rf /opt/mysql
rm -rf /opt/mysql/mysql-5.7.25/bin/mysql
rm -rf /opt/mysql/mysql-5.7.25/include/mysql
rm -rf /opt/mysql/mysql-5.7.25/data/mysq 参见原文链接:
https://blog.csdn.net/qq_31708763/article/details/86485398
安装参考原文:
https://www.cnblogs.com/zyongzhi/p/10063149.html
Linux下的 Mysql 8.0 yum 安装 并修改密码的更多相关文章
- Linux下查看mysql、apache是否安装,安装,卸载等操作
Linux下查看mysql.apache是否安装,并卸载. 指令 ps -ef|grep mysql 得出结果 root ? :: /bin/sh /usr/ ...
- MySQL 8.0 yum安装和配置
MySQL 8.0 centos7.5 x86_64 一.yum安装 1.先卸载机器和mysql有关的东西,有的安装了mariab-lib,会对安装有干扰,卸载了它. [root@localhost ...
- macOS 下的 MySQL 8.0.17 安装与简易配置
如果我写的这篇你看不懂,可能网上也没有你能看懂的教程了 虽然这篇针对的是8.0.x版本,但是关于MySQL配置之类的方法还是通用的 环境信息与适用范围 环境信息 环境/软件 版本 macOS macO ...
- 在 Linux 下搭建 Git 服务器(yum安装)
服务端(linux): 1. 安装git [root@localhost ~]# yum -y install git 2. 增加一个git账户 为了管理的方便,在linux下面增添一个 " ...
- Linux下查看MySQL的安装路径
Linux下查看mysql.apache是否安装,并卸载. 指令 ps -ef|grep mysql 得出结果 root ? :: /bin/sh /usr/ ...
- linux 下配置mysql区分大小写(不区分可能出现找不到表的情况)怎么样使用yum来安装mysql
Linux 默认情况下,数据库是区分大小写的:因此,要将mysql设置成不区分大小写 在my.cof 设置 lower_case_table_names=1(1忽略大小写,0区分大小写) 检查方式:在 ...
- linux下编译qt5.6.0静态库(使用./configure --help来看看都有哪些参数。超详细,有每一个模块的说明。如果改变了安装的目录,需要到安装目录下的bin目录下创建文件qt.conf)(乌合之众)good
linux下编译qt5.6.0静态库 linux下编译qt5.6.0静态库 configure生成makefile 安装选项 Configure选项 第三方库: 附加选项: QNX/Blackberr ...
- Linux下以tar包的形式安装mysql8.0.28
Linux下以tar包的形式安装mysql8.0.28 1.首先卸载自带的Mysql-libs(如果之前安装过mysql,要全都卸载掉) rpm -qa | grep -i -E mysql\|mar ...
- windows下mysql 8.0.12安装步骤及基本使用教程
本文实例为大家分享了windows下mysql 8.0.12安装步骤及使用教程,供大家参考,具体内容如下 补充:mysql 已经更新到了 8.0.19,大致步骤和这个差不多,照着来就完事了. 我下载的 ...
随机推荐
- ELK实战-elasticsearch安装
操作系统: centos版本 7.4 防火墙 关闭 selinux 关闭 elasticsearch版本 6.3.2 java版本 1.8 server1 192.168.10.126 server2 ...
- Idea破解至2089年
我是用的版本是2018.3.6,别的朋友使用的是2019的某个版本,不过关都不影响破解 下载jar包:链接:https://pan.***baidu.***com/s/1aRR0***2YNI9jew ...
- jenkins 集成jmeter-简单篇
测试用例上传至gitlab后,使用jenkins集成gitlab,并执行压测命令 执行完成后,可在jenkins中查看压测报告不同的项目创建最好创建不同的project) [集成]安装&配置& ...
- 深入SpringMVC注解
原文链接:https://blog.csdn.net/chenpeng19910926/article/details/70837756 @Controller 在SpringMVC 中提供了一个非常 ...
- android之Activity的创建与关闭
Activity的启动和关闭 1.启动activity activity的启动分为两种,一种为入口activity,另一种为其他activity 在AndroidManifests进行配置,入口act ...
- C++函数模板详解(一):概念和特性
函数模板是指这样的一类函数:可以用多种不同数据类型的参数进行调用,代表了一个函数家族.它的外表和普通的函数很相似,唯一的区别就是:函数中的有些元素是未确定的,这些元素将在使用的时候才被实例化.先来看一 ...
- 快乐编程大本营【java语言训练班】 6课:用java的对象和类编程
快乐编程大本营[java语言训练班] 6课:用java的对象和类编程 第1节. 什么是对象和类 第2节. 对象的属性和方法 第3节. 类的继承 第4节. 使用举例:创建类,定义方法,定义属性 第5节. ...
- centos6安装lamp
1.安装Apache [root@localhost ~]# yum -y install httpd 设置开启自启动 [root@localhost ~]# chkconfig httpd on 启 ...
- 用goaccess实现可视化并实时监控access日志
goaccess access.log -o ../html/report.html --real-time-html time-format='%H:%M:%S' --date-format=‘%d ...
- 关于使用详解ASP.NET State Service
ASP.NET State Service服务如果启动可以解决这个问题,它会生成一个aspnet_state.exe进程,这个就是Session信息的进程.只要这个进程在,就算是重启了IIS,站点的S ...