我的编程空间,编程开发者的网络收藏夹
学习永远不晚

Linux下的 Mysql 8.0 yum 安装 并修改密码

短信预约 信息系统项目管理师 报名、考试、查分时间动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

Linux下的 Mysql 8.0 yum 安装 并修改密码

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现在以及解压

地址:https://downloads.mysql.com/archives/community/

 

 

 2.linux中下载

 

 

 

在命令中输入这个语句,获取 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

解压:

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.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.18-1.el7.x86_64.rpm

--------------------------------------------------------------------------------

rpm -ivh mysql-community-libs-compat-8.0.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-compat-8.0.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-8.0.18-1.el7.x86_64.rpm
rpm -ivh mysql-community-test-8.0.18-1.el7.x86_64.rpm

--初始化数据库
mysqld --initialize --console
--目录授权,否则启动失败
chown -R mysql:mysql /var/lib/mysql/
--启动服务
systemctl start mysqld

 

6.登陆密码设置

//报错
ERROR 2003 (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-00 log]# service mysqld start
Redirecting to /bin/systemctl start  mysqld.service
[root@Hadoop-00 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 二 2020-02-25 19:09:37 CST; 2s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 3282 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 3306 (mysqld)
   Status: "Server is operational"
   CGroup: /system.slice/mysqld.service
           └─3306 /usr/sbin/mysqld

2月 25 19:09:35 Hadoop-00 systemd[1]: Starting MySQL Server...
2月 25 19:09:37 Hadoop-00 systemd[1]: 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

 

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

Linux下的 Mysql 8.0 yum 安装 并修改密码

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

Linux下的 Mysql 8.0 yum 安装 并修改密码

1.MySQL版本:mysql> select @@version;+-----------+| @@version |+-----------+| 8.0.18 |+-----------+1 row in set (0.00 sec)2.Centos
Linux下的 Mysql 8.0 yum 安装 并修改密码
2019-10-15

Linux下Mysql修改密码 重启mysql服务

如果忘记mysql的密码修改配置文件跳过密码直接登录在[mysqld]下面添加vim /etc/my.cnfskip-grant-tablses重启mysql服务service mysqld restart/etc/rc.d/init.d/mysqld r

	Linux下Mysql修改密码 重启mysql服务
2018-06-24

Linux下如何修改MySQL/MariaDB的Root密码

这篇文章主要介绍了Linux下如何修改MySQL/MariaDB的Root密码,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。修改 MySQL 或 MariaDB 的 root
2023-06-28

mysql-8.0.15-winx64安装与修改密码方式

目录第一步:下载第二步:安装第三步:启动mysql补充总结第一步:下载移步官网:https://www.mysql.com/downloads/ 下载一个压缩包(个人版)第二步:安装解压安装包,根据自己的喜好选择路径将安装包的bin目录
mysql-8.0.15-winx64安装与修改密码方式
2024-10-21

怎么在Linux下修改Mysql的用户root密码

本篇内容介绍了“怎么在Linux下修改Mysql的用户root密码”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!下面给大家分享下在Linux
2023-06-09

在Linux下如何修改Mysql的用户(root)的密码

下面给大家分享下在Linux下如何修改Mysql的用户(root)的密码,分两种情况:第一种当拥有原来的mysql的root密码,第二种情况忘记原来的mysql的root的密码。 修改的用户都以root为列。 一、拥有原来的mysql的ro
2022-06-04

Linux下如何使用yum的方式安装mysql

这篇文章将为大家详细讲解有关Linux下如何使用yum的方式安装mysql,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。\1. 先检查系统是否装有mysql[root@localhost ~]#yum l
2023-06-27

Linux下升级安装python3.8并配置pip及yum的教程

服务器的CentOS 7中自带的python版本是python-2.7.5,需要再安装一个 python-3.8.1 一、查看版本 安装前查看一下是否已经安装过python,我这里自带了python2.7.5版本,所以需要在不删除的情况下,
2022-06-04

编程热搜

目录