栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

centos安装MySQ服务问题

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

centos安装MySQ服务问题

[aurora@localhost ~]$ su
Password:
[root@localhost aurora]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

当显示以下内容为安装正常:
100%[======================================>] 25,548 93.4KB/s in 0.3s
2022-05-09 01:00:20 (93.4 KB/s) - ‘mysql57-community-release-el7-10.noarch.rpm.2’ saved [25548/25548]
-c: No such file or directory
No URLs found in -c.
FINISHED --2022-05-09 01:00:20–
Total wall clock time: 8.5s
Downloaded: 1 files, 25K in 0.3s (93.4 KB/s)

[root@localhost aurora]# yum -y install mysql57-community-release-el7-10.noarch.rpm

Loaded plugins: fastestmirror, langpacks
Examining mysql57-community-release-el7-10.noarch.rpm: mysql57-community-release-el7-10.noarch
mysql57-community-release-el7-10.noarch.rpm: does not update installed package.
Error: Nothing to do
[root@localhost aurora]# yum -y install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    No package mysql-community-server available
    Error: Nothing to do

[root@localhost aurora]# whereis mysql
mysql: /usr/lib64/mysql /usr/share/mysql

[root@localhost aurora]# find / -name mysql
find: ‘/run/user/1000/gvfs’: Permission denied
/etc/selinux/targeted/active/modules/100/mysql
/usr/lib64/mysql
/usr/share/mysql

[root@localhost aurora]# rpm -qa|grep mysql
mysql57-community-release-el7-10.noarch

[root@localhost aurora]# rpm -qa|grep mysql
mysql57-community-release-el7-10.noarch

[root@localhost aurora]# yum -y install mysql-community-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com

No package mysql-community-server available.
Error: Nothing to do

[root@localhost aurora]# wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

100%[======================================>] 9,224 --.-K/s in 0s
2022-05-09 01:11:13 (168 MB/s) - ‘mysql57-community-release-el7-9.noarch.rpm’ saved [9224/9224]

[root@localhost aurora]# rpm -ivh mysql57-community-release-el7-9.noarch.rpm

warning: mysql57-community-release-el7-9.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing… ################################# [100%]
package mysql57-community-release-el7-10.noarch (which is newer than mysql57-community-release-el7-9.noarch) is already installed
file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql from install of mysql57-community-release-el7-9.noarch conflicts with file from package mysql57-community-release-el7-10.noarch
file /etc/yum.repos.d/mysql-community-source.repo from install of mysql57-community-release-el7-9.noarch conflicts with file from package mysql57-community-release-el7-10.noarch
file /etc/yum.repos.d/mysql-community.repo from install of mysql57-community-release-el7-9.noarch conflicts with file from package mysql57-community-release-el7-10.noarch

[root@localhost aurora]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# yum install mysql-server

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com

No package mysql-server available.
Error: Nothing to do

[root@localhost yum.repos.d]# yum -y remove mysql57-community-release-el7-10.noarch

Removing:
mysql57-community-release noarch el7-10 installed
Complete!

[root@localhost aurora]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

100%[======================================>] 25,548 7.72KB/s in 3.2s

2022-05-09 01:17:18 (7.72 KB/s) - ‘mysql57-community-release-el7-10.noarch.rpm.4’ saved [25548/25548]

-c: No such file or directory
No URLs found in -c.
FINISHED --2022-05-09 01:17:18–
Total wall clock time: 6.7s
Downloaded: 1 files, 25K in 3.2s (7.72 KB/s)

[root@localhost aurora]# yum -y install mysql57-community-release-el7-10.noarch.rpm

[root@localhost aurora]# yum -y install mysql-community-server

[root@localhost aurora]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
Failed to start mysqld.service: Unit not found.
[root@localhost aurora]# systemctl start mysql.service
Failed to start mysql.service: Unit not found.
[root@localhost aurora]# systemctl restart mysqld.service
Failed to restart mysqld.service: Unit not found.
[root@localhost aurora]# systemctl start mysqld
Failed to start mysqld.service: Unit not found.
[root@localhost aurora]# systemctl start mysqld.service
Failed to start mysqld.service: Unit not found.
[root@localhost aurora]# yum install -y mysql-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    Resolving Dependencies
    –> Running transaction check
    —> Package mysql-community-server.x86_64 0:5.7.38-1.el7 will be installed
    –> Processing Dependency: mysql-community-common(x86-64) = 5.7.38-1.el7 for package: mysql-community-server-5.7.38-1.el7.x86_64
    –> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.38-1.el7.x86_64
    –> Running transaction check
    —> Package mariadb.x86_64 1:5.5.68-1.el7 will be obsoleted
    —> Package mysql-community-client.x86_64 0:5.7.38-1.el7 will be obsoleting
    –> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.38-1.el7.x86_64
    —> Package mysql-community-common.x86_64 0:5.7.38-1.el7 will be installed
    –> Running transaction check
    —> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
    –> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
    –> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
    —> Package mysql-community-libs.x86_64 0:5.7.38-1.el7 will be obsoleting
    –> Running transaction check
    —> Package mysql-community-libs-compat.x86_64 0:5.7.38-1.el7 will be obsoleting
    —> Package postfix.x86_64 2:2.10.1-6.el7 will be updated
    —> Package postfix.x86_64 2:2.10.1-9.el7 will be an update
    –> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size

Installing:
mysql-community-client x86_64 5.7.38-1.el7 mysql57-community 28 M
replacing mariadb.x86_64 1:5.5.68-1.el7
mysql-community-libs x86_64 5.7.38-1.el7 mysql57-community 2.6 M
replacing mariadb-libs.x86_64 1:5.5.68-1.el7
mysql-community-libs-compat x86_64 5.7.38-1.el7 mysql57-community 1.2 M
replacing mariadb-libs.x86_64 1:5.5.68-1.el7
mysql-community-server x86_64 5.7.38-1.el7 mysql57-community 178 M
Installing for dependencies:
mysql-community-common x86_64 5.7.38-1.el7 mysql57-community 311 k
Updating for dependencies:
postfix x86_64 2:2.10.1-9.el7 base 2.4 M

Transaction Summary

Install 4 Packages (+1 Dependent package)
Upgrade ( 1 Dependent package)

Total size: 212 M
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-client-5.7.38-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

The GPG keys listed for the “MySQL 5.7 Community Server” repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.
Failing package is: mysql-community-client-5.7.38-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

Failing package is: mysql-community-client-5.7.38-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[root@localhost aurora]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
[root@localhost aurora]# yum install -y mysql-serverLoaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.aliyun.com
    Resolving Dependencies
    –> Running transaction check
    —> Package mysql-community-server.x86_64 0:5.7.38-1.el7 will be installed
    –> Processing Dependency: mysql-community-common(x86-64) = 5.7.38-1.el7 for package: mysql-community-server-5.7.38-1.el7.x86_64
    –> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.38-1.el7.x86_64
    –> Running transaction check
    —> Package mariadb.x86_64 1:5.5.68-1.el7 will be obsoleted
    —> Package mysql-community-client.x86_64 0:5.7.38-1.el7 will be obsoleting
    –> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.38-1.el7.x86_64
    —> Package mysql-community-common.x86_64 0:5.7.38-1.el7 will be installed
    –> Running transaction check
    —> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted
    –> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
    –> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
    —> Package mysql-community-libs.x86_64 0:5.7.38-1.el7 will be obsoleting
    –> Running transaction check
    —> Package mysql-community-libs-compat.x86_64 0:5.7.38-1.el7 will be obsoleting
    —> Package postfix.x86_64 2:2.10.1-6.el7 will be updated
    —> Package postfix.x86_64 2:2.10.1-9.el7 will be an update
    –> Finished Dependency Resolution

[root@localhost aurora]# rpm -qa |grep mysqlmysql-community-common-5.7.38-1.el7.x86_64

mysql57-community-release-el7-10.noarch
mysql-community-server-5.7.38-1.el7.x86_64
mysql-community-client-5.7.38-1.el7.x86_64
mysql-community-libs-compat-5.7.38-1.el7.x86_64
mysql-community-libs-5.7.38-1.el7.x86_64

[root@localhost aurora]# systemctl start mysqld.service
[root@localhost aurora]# systemctl status mysqld

● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-05-09 01:38:13 PDT; 32s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 41246 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
Process: 41183 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 41249 (mysqld)
CGroup: /system.slice/mysqld.service
└─41249 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/my…

May 09 01:38:13 localhost.localdomain mysqld[41246]: 2022-05-09T08:38:13.1468…
May 09 01:38:13 localhost.localdomain mysqld[41246]: 2022-05-09T08:38:13.1469…
May 09 01:38:13 localhost.localdomain mysqld[41246]: 2022-05-09T08:38:13.1477…
May 09 01:38:13 localhost.localdomain mysqld[41246]: 2022-05-09T08:38:13.1478…
May 09 01:38:13 localhost.localdomain mysqld[41246]: 2022-05-09T08:38:13.1478…
May 09 01:38:13 localhost.localdomain mysqld[41246]: 2022-05-09T08:38:13.1479…
May 09 01:38:13 localhost.localdomain mysqld[41246]: 2022-05-09T08:38:13.1550…
May 09 01:38:13 localhost.localdomain mysqld[41246]: 2022-05-09T08:38:13.1558…
May 09 01:38:13 localhost.localdomain mysqld[41246]: Version: ‘5.7.38’ socke…
May 09 01:38:13 localhost.localdomain systemd[1]: Started MySQL Server.
Hint: Some lines were ellipsized, use -l to show in full.

[root@localhost aurora]# vim /etc/my.cnf
添加一行登陆时跳过验证的
[root@localhost aurora]# systemctl start mysqld.service
[root@localhost aurora]# mysql -uroot -p

Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.7.38 MySQL Community Server (GPL)

Copyright © 2000, 2022, 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> show databases;
±-------------------+
| Database |
±-------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
±-------------------+
4 rows in set (0.00 sec)

mysql>

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/871139.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号