Centos7安装MySql8出现失败处理
腾讯云centos7安装Mysql过程,以及遇到的问题
centos7安装MySql8
有一个1核2G的腾讯云服务器和阿里云服务器,去年活动打骨折买的,才38一年。今天试着在腾讯云的centos7中安装一个mysql8,但是遇到了些问题,重复卸载几次在安装,在网上搜索了很多,写的不是很清楚。
centos7安装MySql遇到的主要问题
前期安装一直失败了的,网上查到Centos7之后对MySQL安装收费原因,在Centos中自带一个mariadb数据库替代MySql。我通过yum安装mysql先是遇到启动不了服务,卸载后重新安装后可以启动服务但是找不到初始的密码文件,又彻底删除了一次,重新安装千检查是否有mariadb,果然还有在第二次卸载没卸载掉这个。安装前是需要确定以及把mysql以及彻底删除完了!!!
1.检查是否有mariadb数据库
检查是否有mariadb命令: rpm - qa | grep mariadb
[root@VM-16-8-centos /]# rpm -qa | grep mariadb
mariadb-connector-c-config-3.1.11-2.el8_3.noarch
mariadb-backup-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
mariadb-errmsg-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
mariadb-server-utils-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
mariadb-connector-c-3.1.11-2.el8_3.x86_64
mariadb-server-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
mariadb-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
mariadb-common-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
mariadb-gssapi-server-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
[root@VM-16-8-centos /]#
我这个查询多出来很多安装文件,需要全部删除掉。
用SSH工具MobaXterm连接腾讯云,删除掉所有mariadb文件夹(鼠标双击选中文件名后,右键复制到删除命令后,操作的快)
普通删除模式
rpm -e xxx(mysql_libs)
强力删除模式,如果上述命令删除时,提示有依赖其他文件,则可以用该命令对其进行强力删除
rpm -e --nodeps xxx(mysql_libs)
2.删除完重启一次
删除完重启一次,root下用shutdown 命令重启。
立即重启命令(root用户)
shutdown -r now
在查询一下是否还有mariadb依赖
查询mariadb依赖命令
rpm -qa | grep mariadb
此时以前的mysql和mariadb都卸载完了,可以重新在安装MySql了,以前安装成功了但是启动服务后没有初始密码文件就是这里没有卸载干净。可以重新安装了。
3.通过yum的重新安装
下载mysql安装包命令: wget +[http://地址]
wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
通过yum下载rpm包
yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
yum安装mysql
yum install mysql-community-server
启动MySQL服务器
systemctl start mysqld
MySQL的自动启动
systemctl enable mysqld
4.找到mysql存储密码文件,登录mysql
在/var/log目录下找到的mysqld.log,需要用cat mysqld.log | grep password命令或是直接查看文件。
找到了安装初始密码的文件,提示如下:
[Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
用两种命令查看了两次没有密码,发现这个root默认密码是空的,和windows系统安装客户端时遇到的情况一样,也有这种情况出现,可以重新设置密码。下面是敲的命令:
[root@VM-16-8-centos /]# cd /var/log
[root@VM-16-8-centos log]# ll
total 110036
drwxr-xr-x. 2 root root 4096 Nov 26 2019 anaconda
drwx------. 2 root root 4096 Mar 24 09:50 audit
-rw------- 1 root root 14640 Mar 27 17:56 boot.log
-rw------- 1 root root 1 Jan 28 14:16 boot.log-20200828
-rw------- 1 root root 1 Jan 28 14:16 boot.log-20201105
-rw------- 1 root root 1 Jan 28 14:16 boot.log-20210611
-rw------- 1 root root 1 Jan 28 14:16 boot.log-20210624
-rw------- 1 root root 1 Jan 28 14:16 boot.log-20210706
-rw------- 1 root root 1 Jan 28 14:16 boot.log-20210804
-rw------- 1 root root 14691 Jan 28 15:06 boot.log-20220128
-rw-rw---- 1 root utmp 14004096 Mar 27 16:27 btmp
-rw------- 1 root utmp 14848512 Mar 1 02:40 btmp-20220301
drwxr-xr-x. 2 chrony chrony 4096 Mar 2 2021 chrony
-rw-r--r-- 1 syslog adm 215217 Mar 27 17:56 cloud-init.log
-rw-r--r-- 1 root root 10771 Mar 27 17:56 cloud-init-output.log
-rw------- 1 root root 16478544 Mar 27 18:59 cron
-rw------- 1 root root 28365 Mar 27 18:57 dnf.librepo.log
-rw-r--r-- 1 root root 1 Jan 28 14:16 dnf.librepo.log-20200828
-rw------- 1 root root 1 Jan 28 14:16 dnf.librepo.log-20201105
-rw------- 1 root root 118747 Mar 27 18:57 dnf.log
-rw-r--r-- 1 root root 1 Jan 28 14:16 dnf.log-20200828
-rw------- 1 root root 1 Jan 28 14:16 dnf.log-20201105
-rw------- 1 root root 4240 Mar 27 18:57 dnf.rpm.log
-rw-r--r-- 1 root root 1 Jan 28 14:16 dnf.rpm.log-20200828
-rw------- 1 root root 1 Jan 28 14:16 dnf.rpm.log-20201105
-rw------- 1 root root 2400 Mar 27 18:57 hawkey.log
-rw------- 1 root root 1 Jan 28 14:16 hawkey.log-20210624
-rw------- 1 root root 1 Jan 28 14:16 hawkey.log-20210706
-rw------- 1 root root 1 Jan 28 14:16 hawkey.log-20210804
-rw------- 1 root root 61 Jan 28 14:16 hawkey.log-20220128
drwxr-xr-x. 2 root root 4096 Nov 26 2019 insights-client
drwxr-sr-x+ 10 root systemd-journal 4096 Jan 28 14:15 journal
-rw-r--r-- 1 root root 1671 Mar 27 17:56 kdump.log
-rw-rw-r--. 1 root utmp 292584 Mar 27 17:57 lastlog
-rw-------. 1 root root 1 Jan 28 14:16 maillog
drwxr-x--- 2 mysql mysql 4096 Mar 27 13:18 mariadb
-rw-------. 1 root root 40219041 Mar 27 18:58 messages
drwxr-x--- 2 mysql mysql 4096 Mar 27 18:57 mysql
drwx------. 2 root root 4096 Nov 26 2019 private
-rw-r--r-- 1 root root 435 Mar 27 17:56 qcloud_action.log
drwxr-xr-x. 2 root root 4096 May 21 2021 qemu-ga
drwx------. 3 root root 4096 Feb 10 2021 samba
-rw-------. 1 root root 26480455 Mar 27 18:57 secure
-rw-------. 1 root root 1 Jan 28 14:16 spooler
drwxr-x---. 2 sssd sssd 4096 Mar 27 03:13 sssd
drwxr-xr-x. 2 root root 4096 Jun 2 2021 tuned
-rw-rw-r--. 1 root utmp 18048 Mar 27 17:56 wtmp
[root@VM-16-8-centos log]# cd mysql
[root@VM-16-8-centos mysql]# ll
total 4
-rw-r----- 1 mysql mysql 1945 Mar 27 18:58 mysqld.log
[root@VM-16-8-centos mysql]# cat mysql.log
cat: mysql.log: No such file or directory
[root@VM-16-8-centos mysql]# cat mysqld.log
2022-03-27T10:58:05.321138Z 0 [System] [MY-013169] [Server] /usr/libexec/mysqld (mysqld 8.0.26) initializing of server in progress as process 10936
2022-03-27T10:58:05.332667Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-03-27T10:58:06.600239Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-03-27T10:58:08.360777Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2022-03-27T10:58:08.361215Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2022-03-27T10:58:08.501370Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2022-03-27T10:58:13.388855Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.26) starting as process 10998
2022-03-27T10:58:13.400986Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-03-27T10:58:13.802197Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2022-03-27T10:58:14.138526Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2022-03-27T10:58:14.138654Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2022-03-27T10:58:14.139654Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2022-03-27T10:58:14.139852Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-03-27T10:58:14.161162Z 0 [System] [MY-010931] [Server] /usr/libexec/mysqld: ready for connections. Version: '8.0.26' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution.
2022-03-27T10:58:14.161264Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/lib/mysql/mysqlx.sock
[root@VM-16-8-centos mysql]# cat mysqld.log | grep password
2022-03-27T10:58:08.501370Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
[root@VM-16-8-centos mysql]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.26 Source distributionCopyright (c) 2000, 2021, Oracle and/or its affiliates.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>
修改root用户登录密码
mysql> ALTER USER ‘root’@‘localhost’ IDENTIFIED BY ‘Huawei@123’
重新安装后我这个root密码是空的,重新设置了一下root密码。还要给这个数据库配置一下远程连接,阿里云那个RDS数据库可以直接设置白名单,用Navicat远程连接阿里云数据库。
相应参考文章连接:
https://blog.csdn.net/qq_41389482/article/details/109711389
https://cloud.tencent.com/developer/article/1745084
Centos7安装MySql8出现失败处理相关推荐
- CentOS7 安装 mysql8
本文主要从以下几个方面对自己在centos7 下安装mysql8过程做如下总结: CentOS7 安装mysql8 步骤: window下的Navicat 连接MySql8: 涉及到的Linux命令 ...
- centos7安装Mysql8.0步骤
CentOS7安装mysql8.0步骤 1.1 安装前清理工作: 1.1.1 清理原有的mysql数据库: 使用以下命令查找出安装的mysql软件包和依赖包: rpm -pa | grep mysql ...
- Centos7 安装mysql8.0.21 Compressed TAR Archive版
Centos7 安装mysql8.0.21 Compressed TAR Archive版 一.官网下载安装包https://downloads.mysql.com/archives/communit ...
- CentOS7安装MySQL8.0和Nginx
本文档包括使用 PHP-FPM 为 Nginx 1.4.x HTTP 服务器安装和配置 PHP 的说明和提示. 本指南假定您已经从源代码成功构建 Nginx,并且其二进制文件和配置文件都位于 /usr ...
- centos7安装MySQL8以及各种管理工具
1.安装MySQL8. 首先查看 mysql 安装了哪些东西,为了先把自带的MySQL5删除. rpm -qa | grep -i mysql 若返回如下情况,说明存在mysql (我已经安装了MyS ...
- 【mysql】新手必备 centos7 安装mysql8
文章目录 前言 实验环境 1. 内核版本 2. 操作系统版本: 3. 准备mysql数据库及版本: 4. 卸载掉机器中mariadb的包 5. 关闭selinux和防火墙 注意: 正式安装mysql ...
- CentOS7安装mysql8并配置
一.下载 对应版本进去复制下载地址,我这里的下载地址为mysql8.0版本https://dev.mysql.com/get/mysql80-community-release-el7-3.noarc ...
- CentOS7安装MySQL8.0图文教程
1.下载 MySQL 所需要的安装包 网址:https://dev.mysql.com/downloads/mysql/ 2.Select Operating System: 选择 Red Hat , ...
- Centos7 安装 ftp服务器 --失败了 妈蛋的
一.准备安装 1.查看当前是否安装 # rpm -q vsftpd package vsftpd is not installed (显示没有安装) 二.安装 # yum install vsftp ...
最新文章
- 读取Assets中的文件数据
- JFreeChart_API
- [转]英语飙升的好方法
- ZooKeeper 如何保证数据一致性
- Linux学习:目录遍历函数
- CG-CTF-Web-文件包含
- implements Serializable
- STM32H743+CubeMX-ADC(16bit分辨率)+DMA采样三路模拟量(并行),没过采样。
- Java基础---API概述---常用类(Object类/String类)---equals和==
- 转载-配置tomcat让shtml嵌套文件显示
- 软件测试怎么自学?史上最全的「软件测试」自学路线图+资源包
- 漏洞复现之CVE-2018-1273 Spring Data Commons 远程命令执行
- Futaba M11BT222A VFD(主控PT6311)STC51单片机驱动程序
- 站群服务器金手指排名稳定,黑帽seo手法使用金手指:黑帽SEO,常见的SEO作弊手...
- __imp____iob_func和__imp__fprintf
- 中软外包创维面试,尬聊半小时
- 终端改变字体颜色和背景,控制光标,设置屏幕,更改样式与ANSI Esc(\033,\x1B,\e)转义序列用法
- windows10+YOLOv4+darknet
- Windows Server HP 服务器磁盘阵列检测
- 综合布线---关于线缆的一些小知识(1)