广告
返回顶部
首页 > 资讯 > 数据库 >安装mysql数据库及问题解决方法
  • 872
分享到

安装mysql数据库及问题解决方法

2024-04-02 19:04:59 872人浏览 独家记忆
摘要

1、Mysql官网下载安装包,官网地址:www.mysql.com [root@seiang software]# ll total 580020 -rw-r--r--. 1

1、Mysql官网下载安装包,官网地址:www.mysql.com

[root@seiang software]# ll

total 580020

-rw-r--r--. 1 root root 593940480 Mar 25 18:57 mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar

 

2、解压

[root@seiang software]# tar xvf mysql-5.7.21-1.el7.x86_64.rpm-bundle.tar

mysql-commUnity-embedded-devel-5.7.21-1.el7.x86_64.rpm

mysql-community-minimal-debuginfo-5.7.21-1.el7.x86_64.rpm

mysql-community-common-5.7.21-1.el7.x86_64.rpm

mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm

mysql-community-embedded-compat-5.7.21-1.el7.x86_64.rpm

mysql-community-server-minimal-5.7.21-1.el7.x86_64.rpm

mysql-community-client-5.7.21-1.el7.x86_64.rpm

mysql-community-server-5.7.21-1.el7.x86_64.rpm

mysql-community-embedded-5.7.21-1.el7.x86_64.rpm

mysql-community-test-5.7.21-1.el7.x86_64.rpm

mysql-community-devel-5.7.21-1.el7.x86_64.rpm

mysql-community-libs-5.7.21-1.el7.x86_64.rpm

 

3、全部安装,出现如下的报错

[root@seiang software]# rpm -ivh *.rpm

warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

error: Failed dependencies:

        mariadb-libs is obsoleted by mysql-community-libs-5.7.21-1.el7.x86_64

        mariadb-libs is obsoleted by mysql-community-libs-compat-5.7.21-1.el7.x86_64

        perl(Data::Dumper) is needed by mysql-community-test-5.7.21-1.el7.x86_64

        perl(JSON) is needed by mysql-community-test-5.7.21-1.el7.x86_64

 

4、如上的报错,由于Centos 7默认是mariadb数据库,再去安装mysql之前要先下载mariadb

[root@seiang software]# rpm -qa | grep mariadb

mariadb-libs-5.5.41-2.el7_0.x86_64

 

[root@seiang software]# rpm -e mariadb-libs-5.5.41-2.el7_0.x86_64

error: Failed dependencies:

        libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64

        libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64

 

由于存在依赖关系,强制卸载

[root@seiang software]# rpm -e --nodeps mariadb-libs-5.5.41-2.el7_0.x86_64

 

5、安装mysql-server,出现报错

[root@seiang software]# rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm

warning: mysql-community-server-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

error: Failed dependencies:

        mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.21-1.el7.x86_64

        mysql-community-common(x86-64) = 5.7.21-1.el7 is needed by mysql-community-server-5.7.21-1.el7.x86_64

 

6、根据提示,要先安装mysql-community-common和mysql-community-client包

[root@seiang software]# rpm -ivh mysql-community-common-5.7.21-1.el7.x86_64.rpm

warning: mysql-community-common-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-common-5.7.21-1.e################################# [100%]

 

 7、安装mysql-client包,出现如下的报错

[root@seiang software]# rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm

warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

error: Failed dependencies:

        mysql-community-libs(x86-64) >= 5.7.9 is needed by mysql-community-client-5.7.21-1.el7.x86_64

 

8、根据提示先安装 mysql-community-libs包

[root@seiang software]# rpm -ivh mysql-community-libs-5.7.21-1.el7.x86_64.rpm

warning: mysql-community-libs-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-libs-5.7.21-1.el7################################# [100%]

 

9、再次尝试安装mysql-client

[root@seiang software]# rpm -ivh mysql-community-client-5.7.21-1.el7.x86_64.rpm

warning: mysql-community-client-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-client-5.7.21-1.e################################# [100%]

 

10、最后安装mysql-server

[root@seiang software]# rpm -ivh mysql-community-server-5.7.21-1.el7.x86_64.rpm

warning: mysql-community-server-5.7.21-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql-community-server-5.7.21-1.e################################# [100%]

 

11、查看mysql的服务

[root@seiang software]# systemctl status mysqld.service

mysqld.service - MySQL Server

   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)

   Active: inactive (dead)

     Docs: man:mysqld(8)

           Http://dev.mysql.com/doc/refman/en/using-systemd.html

 

12、启动mysql服务

[root@seiang software]# systemctl start mysqld.service

[root@seiang software]#

[root@seiang software]# systemctl status mysqld.service

mysqld.service - MySQL Server

   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)

   Active: active (running) since Mon 2018-03-26 09:26:04 CST; 2s aGo

     Docs: man:mysqld(8)

           http://dev.mysql.com/doc/refman/en/using-systemd.html

  Process: 2113 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)

  Process: 2034 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

 Main PID: 2116 (mysqld)

   CGroup: /system.slice/mysqld.service

           鈹斺攢2116 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

 

Mar 26 09:25:54 seiang systemd[1]: Starting MySQL Server...

Mar 26 09:26:04 seiang systemd[1]: Started MySQL Server.

 

13、mysql服务启动成功,首先使用临时的密码进行登录,查看临时密码

[root@seiang software]#  grep "passWord" /var/log/mysqld.log

2018-03-25T11:18:09.770923Z 1 [Note] A temporary password is generated for root@localhost: &)2KIh?M3hr7

2018-03-25T11:19:39.853663Z 2 [Note] Access denied for user 'root'@'localhost' (using password: YES)

2018-03-25T11:22:20.996230Z 3 [Note] Access denied for user 'root'@'localhost' (using password: NO)

2018-03-25T11:24:31.219087Z 0 [Note] Shutting down plugin 'validate_password'

2018-03-25T11:24:33.062278Z 0 [Note] Shutting down plugin 'sha256_password'

2018-03-25T11:24:33.062286Z 0 [Note] Shutting down plugin 'mysql_native_password'

2018-03-26T01:25:57.938742Z 1 [Note] A temporary password is generated for root@localhost: v,esvf2?oj?T

 

14、使用临时密码登录,然后修改root的密码

[root@seiang software]# mysql -uroot -pv,esvf2?oj?T

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.21

 

Copyright (c) 2000, 2018, 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>

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'beijing';

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'qcloud@2018';

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 

两次修改都提示相同的错误:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

 

下面是官方文档,对于该问题的解释:

https://dev.mysql.com/doc/refman/5.7/en/validate-password.html

 

上述报错的原因:其实与validate_password_policy的值有关。

validate_password_policy有以下取值:

安装mysql数据库及问题解决方法 

默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。

 

解决方法:

修改validate_password_policy参数的值

mysql> set global validate_password_policy=0;

Query OK, 0 rows affected (0.00 sec)

 

mysql> select @@validate_password_length;

+----------------------------+

| @@validate_password_length |

+----------------------------+

|                 8 |

+----------------------------+

1 row in set (0.05 sec)

 

默认的密码长度是8,少于8位依旧会出现报错 

mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'beijing';

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

修改成功 

mysql>  ALTER USER 'root'@'localhost' IDENTIFIED BY 'qcloud@2018';

Query OK, 0 rows affected (0.00 sec)

 

15、使用新密码再次登录,登录成功

[root@seiang software]# mysql -uroot -pqcloud@2018

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.7.21 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2018, 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>


 

16、由于习惯于linux的提示,所以我们为mysql也设置提示

(1)临时设置

mysql> prompt \u@ \h \d >

root@ localhost (none) >

root@ localhost (none) >use mysql;

Reading table infORMation for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

root@ localhost mysql >prompt \u@\h [\d]>

PROMPT set to '\u@\h [\d]>'

root@localhost [mysql]>

root@localhost [mysql]>

 

(2)永久设置

[root@seiang ~]# vim /etc/my.cnf

添加下面两句,注意:[]中是mysql,不是mysqld

[mysql]

prompt=\u@\h [\d]>



作者:SEian.G(苦练七十二变,笑对八十一难)

您可能感兴趣的文档:

--结束END--

本文标题: 安装mysql数据库及问题解决方法

本文链接: https://www.lsjlt.com/news/47580.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

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

下载Word文档
猜你喜欢
  • 安装mysql数据库及问题解决方法
    1、mysql官网下载安装包,官网地址:www.mysql.com [root@seiang software]# ll total 580020 -rw-r--r--. 1...
    99+
    2022-10-18
  • SQL Server数据库安装时常见问题以及解决方法
    这期内容当中小编将会给大家带来有关SQL Server数据库安装时常见问题以及解决方法,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。常见问题一:安装Sql Server ...
    99+
    2022-10-18
  • 安装SQLServer数据库的时的常见问题及解决方法
    本篇内容主要讲解“安装SQLServer数据库的时的常见问题及解决方法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“安装SQLServer数据库的时的常见问题及...
    99+
    2022-10-18
  • linux 安装 mysql 8.0.19 详细步骤及问题解决方法
    最近买了个腾讯云服务器,搭建环境。 该笔记用于系统上未装过mysql的干净系统第一次安装mysql。自己指定安装目录,指定数据文件目录。 linux系统版本: CentOS 7.3 64位 安装源文件版本:mysql...
    99+
    2022-06-03
    linux mysql8.0.19 安装 linux mysql安装步骤
  • pip安装Python库时遇到的问题及解决方法
    笔者电脑系统是win7,同时安装了Python2.7和Python3.6,但是在通过命令行直接使用“pip install XXX”安装Python库时出现了以下的错误信息: Fatal error in ...
    99+
    2022-06-04
    解决方法 pip Python
  • win10+anaconda安装yolov5的方法及问题解决方案
    目录YOLOV5-3.0/3.1版本版本问题YOLOV5-4.0版本电脑配置过程中的一些报错报错1:打开摄像头报错报错2:摄像头报错报错3:在创建虚拟环境后,安装库的时候出现错误报错...
    99+
    2022-11-12
  • 数据库编程中的Python问题及解决方法
    数据库编程中的Python问题及解决方法引言:在现代软件开发中,数据库是不可或缺的一部分。Python作为一门功能强大的编程语言,可以与多种数据库进行交互和操作。然而,在数据库编程过程中,我们可能会遇到一些问题。本文将介绍一些常见的Pyth...
    99+
    2023-10-22
    Python 编程 关键词:数据库
  • MySQL安装时一直卡在starting server的问题及解决方法
    目录1.首先将 MySQL 停止运行.2.卸载 MySQL(这里使用的官方工具)3.在我们之前安装 MySQL 的地方检查有没有残留的文件 , 并将其手动删除.(我是默认c盘的)4....
    99+
    2022-11-13
  • 安装vCenter6.0遇到的问题以及解决方法
    实验环境: 在Window Server 2008 R2上安装vCenter6.0,数据库采用的SQL Server2012   问题一: 安装到50%的时候提示:无法启动invsvc服务以及无法运行vdcpromo等各种问题,点...
    99+
    2023-06-04
  • MySQL数据库的介绍及安装方法
    本篇内容介绍了“MySQL数据库的介绍及安装方法”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!  一、My...
    99+
    2022-10-18
  • Mysql时区问题及解决方法
    MySQL是一种常用的开源关系型数据库,它在处理时间和日期时会受到时区的影响。因此,在使用MySQL时,时区设置容易引发一些错误。本文将介绍MySQL时区问题可能引发的错误,并提供一些解决方案。 错误1:时间不正确 在使用MySQL时,如果...
    99+
    2023-09-05
    mysql 数据库
  • PyCharm软件无法安装lxml库的问题及解决
    目录pycharm安装lxml库失败怎么办?一般的安装流程流程为总结pycharm安装lxml库失败怎么办? 众所周知,在pycharm中安装lxml库, 一般的安装流程流程为 fi...
    99+
    2023-01-04
    PyCharm无法安装lxml库 PyCharm安装lxml库 PyCharm lxml库
  • 如何解决python连接数据库mysql解压版安装配置及遇到问题
    这篇文章主要为大家展示了“如何解决python连接数据库mysql解压版安装配置及遇到问题”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“如何解决python连接...
    99+
    2022-10-18
  • python3.7+anaconda 安装opencv和dlib的问题及解决方法
    找了很久看了很久,然后发现其实很简单… 问题 发现anaconda环境里有opencv可以直接下载,但是等了很久都下载不下来。 然后按照网上别的方法直接在anaconda prompt里面pip也不行。opencv...
    99+
    2022-06-02
    python anaconda安装opencv和dlib python anaconda安装dlib
  • Oracle在Centos7.5安装遇到的问题及解决方法
    本篇内容主要讲解“Oracle在Centos7.5安装遇到的问题及解决方法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Oracle在Centos7.5安装遇到...
    99+
    2022-10-18
  • pycharm无法安装cv2模块问题及解决方案
    目录pycharm安装cv2模块安装失败和无法使用的解决步骤一步骤二步骤三pycharm安装cv2遇到的坑pycharm安装cv2模块安装失败和无法使用的解决 步骤一 我们先到这个网...
    99+
    2022-11-11
  • django安装xadmin及问题解决
    目录环境:一,安装二,注册 xadmin:三,配置 URL:四,数据迁移并创建超级用户五,收集media六,运行项目,解决错误七,访问xadmin八,问题补充环境: Windows ...
    99+
    2022-11-11
  • IPython的安装及问题解决
    IPython是python的一个第三方库,本来使用pip(类似于linux的yum)工具是很容易安装的,但是因为版本原因有时会出些问题,比如2.7.x版本的不能安装IPython的最新版本,会报错:报错如下:[root@iZ2ze7qh7...
    99+
    2023-06-02
  • MySQL数据库执行Update卡死问题的解决方法
    目录问题分析解决办法过程复现和解决扩展总结执行数据库更新update操作的时候数据库卡死了 问题分析 一般都是数据库事务未提交,导致update或者delete卡死。 解决...
    99+
    2022-11-13
  • 外部navicat无法连接mysql数据库的问题原因及解决方案
    问题起因是这样:在linux操作中的docker中部署了一个数据库,数据库启动之后,端口也映射了(创建容器时用 -p 30036:3306进行的映射),但是在外不想使用navicat连接时,怎么都连不上,本人遇到的问题如下 一、端口虽然映射...
    99+
    2023-09-22
    数据库 linux 服务器
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作