CentOS7安装MySQL冲突和问题解决小结

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: 问题1: [root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm Preparing...                          ################################# [100%]  file /usr/share/mysql/charsets
问题1:
[root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm
Preparing...                          ################################# [100%]
 file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
 file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
 file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64 file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
 file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-5.6.27-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
    ……………………
解决1:
出现以上安装错误列表的原因是:系统已经安装了其他版本的mysql-libs包和mysql数据库文件导致不兼容。
[root@localhost install-files]# yum remove mysql-libs
执行之后,还要详细检查卸载MySQL安装的所有文件,否则在后续安装发生各种错误: CentOS下MySQL的彻底卸载
问题2:
[root@Tony_ts_tian developer]# rpm -ivh MySQL-server-5.5.46-1.el6.x86_64.rpm
warning: MySQL-server-5.5.46-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
解决2:
从 rpm版本 4.1 开始,在安装或升级软件包时会检查软件包的签名。如果签名校验失败,你就会看到类似以上的错误消息:
注:新的、只针对文件头的签名:错误消息:error: Header V3 DSA signature: BAD, key ID 0352860f
注:没有安装合适的钥匙来校验签名,消息中就会包含 NOKEY:错误消息:warning: V3 DSA signature: NOKEY, key ID 0352860f
由于yum安装了旧版本的GPG keys造成的,解决办法就是(设置后无效):
rpm --import /etc/pki/rpm-gpg/RPM*
此签名是检验安装包的有效性和安装性的。我直接跳过(安装时不校验,加--nosignature参数)检验安装:
[root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature
问题3:
mysqld: unrecognized service
[root@Tony_ts_tian init.d]# service mysqld start
mysqld: unrecognized service
解决3:
启动脚本文件mysql的目录
[root@localhost install-files]# cd /etc/rc.d/init.d/
[root@localhost init.d]# ls
functions  mysql  netconsole  network  README
并没有mysqld:
[root@Tony_ts_tian init.d]# service mysql start
启动成功:
也可以:
[root@Tony_ts_tian init.d]# mv mysql mysqld
[root@Tony_ts_tian init.d]# service mysqld start
问题4:
[root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-server-5.6.27-1.el6        ################################# [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:
Data::Dumper
解决4:
[root@localhost install-files]# yum install -y perl-Module-Install.noarch
问题5:
[root@localhost mysql]# service mysql start
Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).
[root@localhost init.d]# cd /var/lib/mysql/
[root@localhost mysql]# ll
total 110620
-rw-rw----. 1 mysql mysql       56 Oct 11 23:20 auto.cnf
-rw-rw----. 1 mysql mysql 12582912 Oct 11 23:20 ibdata1
-rw-rw----. 1 mysql mysql 50331648 Oct 11 23:20 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 Oct 11 23:19 ib_logfile1
-rw-r-----. 1 mysql root      5847 Oct 11 23:20 localhost.localdomain.err
drwx--x--x. 2 mysql mysql     4096 Oct 11 23:19 mysql
drwx------. 2 mysql mysql     4096 Oct 11 23:19 performance_schema
-rw-r--r--. 1 root  root       111 Oct 11 23:19 RPM_UPGRADE_HISTORY
-rw-r--r--. 1 mysql mysql      111 Oct 11 23:19 RPM_UPGRADE_MARKER-LAST
drwxr-xr-x. 2 mysql mysql        6 Oct 11 23:19 test
查看路径:mysql-bin.index多余文件,auto.cnf和performance_schema等不存在(文件不全)。(以上为成功后的mysql数据库目录)
解决5:
因为以前存在的MySQL卸载不干净导致。
删除和卸载(以下是的解决),然后重新安装: CentOS下MySQL的彻底卸载
[root@localhost mysql]# rpm -aq | grep -i mysql
MySQL-server-5.6.27-1.el6.x86_64
MySQL-client-5.6.27-1.el6.x86_64
MySQL-devel-5.6.27-1.el6.x86_64
[root@localhost mysql]# rpm -e MySQL-server-5.6.27-1.el6.x86_64
[root@localhost mysql]# rpm -e MySQL-client-5.6.27-1.el6.x86_64
[root@localhost mysql]# rpm -e MySQL-devel-5.6.27-1.el6.x86_64
[root@localhost rc.d]# cd /var/lib/
[root@localhost lib]# rm -rf mysql/
[root@localhost install-files]# rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm --nosignature
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-server-5.6.27-1.el6        ################################# [100%]
2015-10-11 23:19:40 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-10-11 23:19:40 0 [Note] /usr/sbin/mysqld (mysqld 5.6.27) starting as process 3168 ...
2015-10-11 23:19:40 3168 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-10-11 23:19:40 3168 [Note] InnoDB: The InnoDB memory heap is disabled
2015-10-11 23:19:40 3168 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-10-11 23:19:40 3168 [Note] InnoDB: Memory barrier is not used
2015-10-11 23:19:40 3168 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-10-11 23:19:40 3168 [Note] InnoDB: Using Linux native AIO
2015-10-11 23:19:40 3168 [Note] InnoDB: Using CPU crc32 instructions
2015-10-11 23:19:40 3168 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-10-11 23:19:40 3168 [Note] InnoDB: Completed initialization of buffer pool
2015-10-11 23:19:40 3168 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-10-11 23:19:40 3168 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-10-11 23:19:40 3168 [Note] InnoDB: Database physically writes the file full: wait...
2015-10-11 23:19:40 3168 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-10-11 23:19:41 3168 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-10-11 23:19:43 3168 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-10-11 23:19:43 3168 [Warning] InnoDB: New log files created, LSN=45781
2015-10-11 23:19:43 3168 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-10-11 23:19:43 3168 [Note] InnoDB: Doublewrite buffer created
2015-10-11 23:19:43 3168 [Note] InnoDB: 128 rollback segment(s) are active.
2015-10-11 23:19:43 3168 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-10-11 23:19:43 3168 [Note] InnoDB: Foreign key constraint system tables created
2015-10-11 23:19:43 3168 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-10-11 23:19:43 3168 [Note] InnoDB: Tablespace and datafile system tables created.
2015-10-11 23:19:43 3168 [Note] InnoDB: Waiting for purge to start
2015-10-11 23:19:43 3168 [Note] InnoDB: 5.6.27 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2015-10-11 23:19:44 3168 [Note] Binlog end
2015-10-11 23:19:44 3168 [Note] InnoDB: FTS optimize thread exiting.
2015-10-11 23:19:44 3168 [Note] InnoDB: Starting shutdown...
2015-10-11 23:19:46 3168 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2015-10-11 23:19:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-10-11 23:19:46 0 [Note] /usr/sbin/mysqld (mysqld 5.6.27) starting as process 3190 ...
2015-10-11 23:19:46 3190 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-10-11 23:19:46 3190 [Note] InnoDB: The InnoDB memory heap is disabled
2015-10-11 23:19:46 3190 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-10-11 23:19:46 3190 [Note] InnoDB: Memory barrier is not used
2015-10-11 23:19:46 3190 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-10-11 23:19:46 3190 [Note] InnoDB: Using Linux native AIO
2015-10-11 23:19:46 3190 [Note] InnoDB: Using CPU crc32 instructions
2015-10-11 23:19:46 3190 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-10-11 23:19:46 3190 [Note] InnoDB: Completed initialization of buffer pool
2015-10-11 23:19:46 3190 [Note] InnoDB: Highest supported file format is Barracuda.
2015-10-11 23:19:46 3190 [Note] InnoDB: 128 rollback segment(s) are active.
2015-10-11 23:19:46 3190 [Note] InnoDB: Waiting for purge to start
2015-10-11 23:19:46 3190 [Note] InnoDB: 5.6.27 started; log sequence number 1625977
2015-10-11 23:19:46 3190 [Note] Binlog end
2015-10-11 23:19:46 3190 [Note] InnoDB: FTS optimize thread exiting.
2015-10-11 23:19:46 3190 [Note] InnoDB: Starting shutdown...
2015-10-11 23:19:49 3190 [Note] InnoDB: Shutdown completed; log sequence number 1625987

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/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

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

检查:
[root@localhost install-files]# service mysql start
Starting MySQL.. SUCCESS! 
[root@localhost install-files]# service mysql stop
Shutting down MySQL.. SUCCESS! 
[root@localhost mysql]# ll
total 110620
-rw-rw----. 1 mysql mysql       56 Oct 11 23:20 auto.cnf
-rw-rw----. 1 mysql mysql 12582912 Oct 11 23:20 ibdata1
-rw-rw----. 1 mysql mysql 50331648 Oct 11 23:20 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 Oct 11 23:19 ib_logfile1
-rw-r-----. 1 mysql root      5847 Oct 11 23:20 localhost.localdomain.err
drwx--x--x. 2 mysql mysql     4096 Oct 11 23:19 mysql
drwx------. 2 mysql mysql     4096 Oct 11 23:19 performance_schema
-rw-r--r--. 1 root  root       111 Oct 11 23:19 RPM_UPGRADE_HISTORY
-rw-r--r--. 1 mysql mysql      111 Oct 11 23:19 RPM_UPGRADE_MARKER-LAST
drwxr-xr-x. 2 mysql mysql        6 Oct 11 23:19 test
设置后,也可以:mysql -u root -p;进行登录测试。
成功的安装,日志中显示(创建两个文件):
A random root password has been set. You will find it in ' /root/.mysql_secret'.
New default config file was created as /usr/my.cnf andwill be used by default by the server when you start it.
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
7天前
|
关系型数据库 MySQL Linux
linux CentOS 7.4下 mysql5.7.20 密码改简单的方法
linux CentOS 7.4下 mysql5.7.20 密码改简单的方法
14 0
|
4天前
|
关系型数据库 MySQL 数据安全/隐私保护
MySQL 安装及连接
MySQL 安装及连接
20 0
|
6天前
|
关系型数据库 MySQL 数据库
docker自定义安装mysql 5.7
docker自定义安装mysql 5.7
15 0
|
7天前
|
关系型数据库 MySQL Linux
CentOS 7 下使用yum安装MySQL5.7.20 最简单 图文详解
CentOS 7 下使用yum安装MySQL5.7.20 最简单 图文详解
32 0
|
2月前
|
缓存 关系型数据库 MySQL
百度搜索:蓝易云【CentOS8服务器安装MySQL报错:no match mysql-community-server】
现在,你已经成功安装了MySQL服务器并解决了"no match mysql-community-server"的报错问题。祝你使用愉快!
42 1
|
4月前
|
Linux Shell Swift
django(二)centos安装django3.2报错SQLite 3.8.3 or later is required (found 3.7.17)
我正在参加「掘金·启航计划」 Centos安装diango3.2框架请参照《django(一)ubuntu18.04安装框架》 在运行: 复制代码 python3 manage.py runserver 0.0.0.0:81 的时候报错: swift 复制代码 django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17). 报错的大体意思是:对sqlite最低版本的需求的3.8.3,但是现在只找到了3.7.17。
30 1
|
5月前
Cannot download repomd.xml解决CentOS8 yum安装AppStream报错
Cannot download repomd.xml解决CentOS8 yum安装AppStream报错
|
6月前
|
监控 Linux
CentOS 7安装zabbix-agent 5.0报错:依赖检测失败:libpcre.so.0(64bit)获取GPG密钥失败
CentOS 7安装zabbix-agent 5.0报错:依赖检测失败:libpcre.so.0(64bit)获取GPG密钥失败
127 0
QGS
|
应用服务中间件 nginx
Centos7yum安装nginx,处理端口占用报错
记Centos7yum安装nginx,处理端口占用报错
QGS
281 0
Centos7yum安装nginx,处理端口占用报错
|
Linux 数据库 Docker
CentOS 7安装Docker CE镜像报错问题解决
CentOS 7安装Docker CE镜像报错问题: ** 发现 2 个已存在的 RPM 数据库问题, 'yum check' 输出如下: 7:device-mapper-libs-1.02.170-6.el7_9.5.x86_64 是 7:device-mapper-libs-1.02.170-6.el7.x86_64 的副本 7:device-mapper-libs-1.02.170-6.el7_9.5.x86_64 有缺少的需求 device-mapper = ('7', '1.02.170', '6.el7_9.5')
CentOS 7安装Docker CE镜像报错问题解决

热门文章

最新文章