安装步骤就不多说了,直接跳到安装MySQL-server-5.6.38-1.el7.x86_64.rpm,下面就是操作的错误提示

[root@127 mysql]# rpm -ivh MySQL-client-5.6.38-1.el7.x86_64.rpm
警告:MySQL-client-5.6.38-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:MySQL-client-5.6.38-1.el7        ################################# [100%]
[root@127 mysql]# rpm -ivh MySQL-devel-5.6.38-1.el7.x86_64.rpm
警告:MySQL-devel-5.6.38-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:MySQL-devel-5.6.38-1.el7         ################################# [100%]
[root@127 mysql]# rpm -ivh MySQL-server-5.6.38-1.el7.x86_64.rpm
警告:MySQL-server-5.6.38-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:MySQL-server-5.6.38-1.el7        ################################# [100%]
mkdir: 无法创建目录"/usr/local/mysql/data": 没有那个文件或目录
mkdir: 无法创建目录"/usr/local/mysql/data/mysql": 没有那个文件或目录
mkdir: 无法创建目录"/usr/local/mysql/data/test": 没有那个文件或目录
/var/tmp/rpm-tmp.e4S3qx:行32: /usr/local/mysql/data/RPM_UPGRADE_MARKER: 没有那个文件或目录
chown: 无法访问"/usr/local/mysql/data": 没有那个文件或目录
FATAL ERROR: The parent directory for the data directory '/usr/local/mysql/data' does not exist.
If that path was really intended, please create that directory path and then
restart this script.
If some other path was intended, please use the correct path when restarting this script.
chown: 无法访问"/usr/local/mysql/data": 没有那个文件或目录
chmod: 无法访问"/usr/local/mysql/data/mysql": 没有那个文件或目录
/var/tmp/rpm-tmp.e4S3qx:行146: /usr/local/mysql/data/RPM_UPGRADE_MARKER: 没有那个文件或目录
/var/tmp/rpm-tmp.e4S3qx:行147: /usr/local/mysql/data/RPM_UPGRADE_MARKER: 没有那个文件或目录
/var/tmp/rpm-tmp.e4S3qx:行148: /usr/local/mysql/data/RPM_UPGRADE_MARKER: 没有那个文件或目录
/var/tmp/rpm-tmp.e4S3qx:行150: /usr/local/mysql/data/RPM_UPGRADE_HISTORY: 没有那个文件或目录
mv: 无法获取"/usr/local/mysql/data/RPM_UPGRADE_MARKER" 的文件状态(stat): 没有那个文件或目录
警告:%post(MySQL-server-5.6.38-1.el7.x86_64) 脚本执行失败,退出状态码为 1

因为当时也就找一个教程来,按步骤来安装,我也不知道对方是不是centos7,反正到了这步,就对不上教程了。看提示说

mkdir: 无法创建目录"/usr/local/mysql/data": 没有那个文件或目录,于是我查询了下,/usr/local/目录连mysql都没有,那mkdir可能是因为这个原因,创建data目录失败,后面的提示也是因为这个原因引起的。

找到原因了那就重来,把装了的mysql全部卸载,打以下命令查看

rpm -qa | grep -i mysql

[root@127 mysql]# rpm -qa | grep -i mysql
MySQL-client-5.6.38-1.el7.x86_64
MySQL-server-5.6.38-1.el7.x86_64
MySQL-devel-5.6.38-1.el7.x86_64

把 这3个依次用命令

yum -y remove MySQL-client-5.6.38-1.el7.x86_64

yum -y remove MySQL-server-5.6.38-1.el7.x86_64

yum -y remove MySQL-devel-5.6.38-1.el7.x86_64

再用find / -name mysql把mysql的目录找到,然后删除。

现在开始重新安装,先在/usr/local/中建一个mysql目录,接着按下面顺序

rpm -ivh MySQL-devel-5.6.38-1.el7.x86_64.rpm

rpm -ivh MySQL-client-5.6.38-1.el7.x86_64.rpm

rpm -ivh MySQL-server-5.6.38-1.el7.x86_64.rpm

安装完成后,是一大批英文

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !
You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,
no other statement but 'SET PASSWORD' will be accepted.
See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/local/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test database.
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file /usr/my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as /usr/my-new.cnf,
please compare it with your file and take the changes you need.

WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the servern

居然忘记删除配置文件my.cnf,先不管,运行systemctl netstart mysqld

提示错误不能运行,这个也先不管,打个命令试试mysql -u root -p

这个终于弹出一个有详细提示的错误ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

直接百度一下,找到了以下解决方法([]里的文字是我操作经过)

首先进入超级用户root权限 sudo -i 或者su - root

  切换到默认目录 cd /var/lib/mysql 下查看一下该文件是否存在(可以再次目录下执行以下操作)。[我查询了,没有]

  执行命令 ps -aux | grep mysql

  查看正在运行的进程,把进程杀死(mysql进程)

  执行命令 kill 进程ID [有进程,半天没杀死,后来直接跳过]

  在root权限下执行 vim/vi /etc/mysql/my.cnf ,打开配置文件之后将自己添加的数据删除掉,恢复最原始的配置文件内容。[首先我的地址跟它的不一样,反正我就找到my.cnf把它还原了]

  执行sudo service mysql start ,就会出现 mysql start/running, process 6106,说明mysql服务启动成功!
[我执行的结果跟它的不一样,但有提示SUCCESS,那就是成功了]

mysql服务终于成功启动,安装还没结束,先把初始密码改了,找那段英文提示,我打入命令cat /root/.mysql_secret

# The random password set for the root user at Sat May  9 15:38:31 2020 (local time): id1EADPNz9YLNevT

# The random password set for the root user at Sat May  9 16:20:37 2020 (local time): ku3sFmSwwNKRmSYY

# The random password set for the root user at Sat May  9 16:29:04 2020 (local time): DmudCNs4SjjMbgtk

# The random password set for the root user at Sat May  9 17:08:45 2020 (local time): xGlybDBq1qiLK2wg

找到最后时间的那个,原来我装了这么多次,终于来这一步了,接着又是命令

mysql -u root -p

输入xGlybDBq1qiLK2wg ,终于弹出登录成功

Server version: 5.6.38

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> use mysql
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement#要重置密码

mysql> SET PASSWORD = PASSWORD('123456abc');#设置密码
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;#授权登录
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

至此才算大功告成,这就是centos7.8.2下安装mysql5.6.38的不一样的遭遇!很难找到与教程一样顺的操作!

关于centos7.8.2安装mysql5.6.38的奇遇相关推荐

  1. centos7 yun安装mysql,CentOS7 yum方式安装MySQL5.7

    MySQL 完整的初始密码规则可以通过如下命令查看: mysql> SHOW VARIABLES LIKE 'validate_password%'; +-------------------- ...

  2. 二进制安装mysql集群_实战mysql集群搭建(一)--centos7下二进制安装mysql-5.6

    在超哥的帮助下,完成了基于InnoDb数据引擎的mysql数据库集群搭建,实现了主从复制的功能,本篇博文介绍如何使用二进制安装mysql的方法,具体实现步骤如下: 软件使用说明: Liunx系统:ce ...

  3. CentOS7卸载及安装MySQL5.7

    CentOS7卸载及安装MySQL5.7(笔记) 前言 一.卸载 二.安装 总结 前言 因之前安装的MySQL数据库有问题,现在需要卸载重新安装,因此记录一下卸载及安装步骤 服务器版本:Centos7 ...

  4. Linux随笔16-主从DNS服务搭建以及智能DNS服务搭建、基于CentOS7.6编译安装MySQL-5.7.32

    Contents 1. DNS主从服务器搭建 1.1. DNS简介 1.2. DNS主从服务搭建 1.2.1. 主DNS服务器配置 1.2.2. 从DNS服务器配置 1.2.3. Web服务器准备 1 ...

  5. 源码安装MySQL-5.7.38的脚本

    这是我写的一个MySQL源码安装的脚本,采用菜单模式,根据提示,贴和自己的环境,进行下载.反复修改,运行无误,分享出来,脚本如下: #!/bin/bash # #Author: chenjiao co ...

  6. Centos7使用yum安装MySQL5.6的正确姿势

    centos自带的repo是不会自动更新每个软件的最新版本,所以无法通过yum方式安装MySQL的高级版本. 所以,即使使劲用yum -y install mysql mysql-server mys ...

  7. Centos7下配置安装mysql5.5主从复制(一主两从)

    1:安装mysql5.5数据库 规划: 主:server-1---10.64.5.167 从:server-2---10.64.5.170 从:server-3---10.64.5.172 数据目录: ...

  8. CentOS7使用yum安装MySQL5版本

    1. 下载并安装MySQL5的yum源 rpm -ivh https://repo.mysql.com//mysql57-community-release-el7-9.noarch.rpm 2. 通 ...

  9. centos7 安装mysql5.7.38

    目录 1.更新yum源 2.查看是否安装过mysql 3.删除mysql 4.删除所有出现的目录 5.删除mysql的默认密码 6.下载mysql yum包 7.安装软件源 8.安装mysql源 10 ...

最新文章

  1. vs code中文乱码解决方法
  2. linux shell awk 单引号分割
  3. antd新增一行页码不正确_antd-Table@4.x对rowKey属性的重构
  4. 智能音箱扎堆的技术红海,Rokid 如何杀出一条血路?
  5. subst 的使用 创建虚拟盘符
  6. wifi协议_图解 802.11wifi协议
  7. [4G5G专题-20]:架构-降低业务延时的移动边缘计算MEC-应用服务的下沉。
  8. ADS8332芯片驱动程序
  9. 有关802.11的Beacon帧
  10. vs2013 qt5.6.3安装
  11. 2021最新版上传透明头像易语言源码
  12. IP技术 -- 6 Telemetry
  13. 判断是不是数字 Java_java如何判断是不是数字
  14. 测试银行卡号必看(长度限制及卡号字符类型总结)
  15. 【SQL Server】已更新或删除的行值要么不能使该行成为唯一行,要么改变了多个行 问题解决
  16. 理解为什么女孩子都希望进国企了
  17. 本地计算机无法启动wireless,win7系统使用无线时提示:“windows无法启动wireless”的解决办法...
  18. Python代码在Pycharm中不起作用,但在Jupiter Notebook中执行良好
  19. R语言时间序列函数整理[不断更新]
  20. PhotoShop JavaScript 批处理 学习二

热门文章

  1. Android 开发 Tip 3 -- that was originally added here
  2. CPU:别再拿我当搬砖工了!
  3. 2018最新版省市区三级联动下拉框+所有源代码以及数据库
  4. CSS 如何画一个三角形?原理是什么?
  5. springboot+mybatisplus+postgis实现几何点和线串增删改查分页
  6. access令两列运算得到新属性_大学Access期末各章课后复习题
  7. 今天生日,还要在家远程上班。你们公司什么情况?
  8. 使用meb工具在线热备,将单实例切换为主从
  9. 用Mind Map 激发你的记忆潜能
  10. 家用路由器 实现 Web认证