centos7.8 安装mysql5.7 ,navicat远程连接

[zzx@localhost ~]$ 
[zzx@localhost ~]$ su root
密码:
//第二步 下载 repo.mysql.com/mysql-community-release-el7-5.noarch.rpm  
[root@localhost zzx]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm  
--2020-12-09 09:50:50--  http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
正在解析主机 repo.mysql.com (repo.mysql.com)... 104.101.101.42
正在连接 repo.mysql.com (repo.mysql.com)|104.101.101.42|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:6140 (6.0K) [application/x-redhat-package-manager]
正在保存至: “mysql-community-release-el7-5.noarch.rpm”

100%[======================================>] 6,140       6.20KB/s 用时 1.0s   

2020-12-09 09:50:51 (6.20 KB/s) - 已保存 “mysql-community-release-el7-5.noarch.rpm” [6140/6140])

[root@localhost zzx]# ls  
mysql-community-release-el7-5.noarch.rpm  模板  图片  下载  桌面
公共                                      视频  文档  音乐
[root@localhost zzx]# rpm -ivh mysql-community-release-el7-5.noarch.rpm  
准备中...                          ################################# [100%]
正在升级/安装...
   1:mysql-community-release-el7-5    ################################# [100%]
[root@localhost zzx]# yum install mysql-server  
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.5.6.50-2.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 5.6.50-2.el7,它被软件包 mysql-community-server-5.6.50-2.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 5.6.10,它被软件包 mysql-community-server-5.6.50-2.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mariadb.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-client.x86_64.0.5.6.50-2.el7 将被 舍弃
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 5.6.10,它被软件包 mysql-community-client-5.6.50-2.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.5.6.50-2.el7 将被 安装
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.68-1.el7 将被 取代
--> 正在处理依赖关系 mariadb-libs(x86-64) = 1:5.5.68-1.el7,它被软件包 1:mariadb-devel-5.5.68-1.el7.x86_64 需要
---> 软件包 mysql-community-libs.x86_64.0.5.6.50-2.el7 将被 舍弃
--> 正在检查事务
---> 软件包 mariadb-devel.x86_64.1.5.5.68-1.el7 将被 取代
---> 软件包 mysql-community-devel.x86_64.0.5.6.50-2.el7 将被 舍弃
--> 解决依赖关系完成

依赖关系解决

================================================================================
 Package                   架构      版本            源                    大小
================================================================================
正在安装:
 mysql-community-client    x86_64    5.6.50-2.el7    mysql56-community     21 M
      替换  mariadb.x86_64 1:5.5.68-1.el7
 mysql-community-devel     x86_64    5.6.50-2.el7    mysql56-community    3.4 M
      替换  mariadb-devel.x86_64 1:5.5.68-1.el7
 mysql-community-libs      x86_64    5.6.50-2.el7    mysql56-community    2.2 M
      替换  mariadb-libs.x86_64 1:5.5.68-1.el7
 mysql-community-server    x86_64    5.6.50-2.el7    mysql56-community     67 M
为依赖而安装:
 mysql-community-common    x86_64    5.6.50-2.el7    mysql56-community    287 k

事务概要
================================================================================
安装  4 软件包 (+1 依赖软件包)

总下载量:93 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/mysql56-community/packages/mysql-community-common-5.6.50-2.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
mysql-community-common-5.6.50-2.el7.x86_64.rpm 的公钥尚未安装
(1/5): mysql-community-common-5.6.50-2.el7.x86_64.rpm      | 287 kB   00:04     
(2/5): mysql-community-client-5.6.50-2.el7.x86_64.rpm      |  21 MB   00:20     
(3/5): mysql-community-libs-5.6.50-2.el7.x86_64.rpm        | 2.2 MB   00:01     
(4/5): mysql-community-devel-5.6.50-2.el7.x86_64.rpm       | 3.4 MB   00:24     
(5/5): mysql-community-server-5.6.50-2.el7.x86_64.rpm      |  67 MB   00:25     
--------------------------------------------------------------------------------
总计                                               1.9 MB/s |  93 MB  00:47     
从 file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:
 用户ID     : "MySQL Release Engineering <mysql-build@oss.oracle.com>"
 指纹       : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5
 软件包     : mysql-community-release-el7-5.noarch (installed)
 来自       : file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
** 发现 1 个已存在的 RPM 数据库问题, 'yum check' 输出如下:
ksh-20120801-142.el7.x86_64 有已安装冲突 pdksh: pdksh-5.2.14-37.el5_8.1.x86_64
  正在安装    : mysql-community-common-5.6.50-2.el7.x86_64                  1/8 
  正在安装    : mysql-community-libs-5.6.50-2.el7.x86_64                    2/8 
  正在安装    : mysql-community-client-5.6.50-2.el7.x86_64                  3/8 
  正在安装    : mysql-community-server-5.6.50-2.el7.x86_64                  4/8 
  正在安装    : mysql-community-devel-5.6.50-2.el7.x86_64                   5/8 
  正在删除    : 1:mariadb-devel-5.5.68-1.el7.x86_64                         6/8 
  正在删除    : 1:mariadb-5.5.68-1.el7.x86_64                               7/8 
  正在删除    : 1:mariadb-libs-5.5.68-1.el7.x86_64                          8/8 
  验证中      : mysql-community-server-5.6.50-2.el7.x86_64                  1/8 
  验证中      : mysql-community-common-5.6.50-2.el7.x86_64                  2/8 
  验证中      : mysql-community-devel-5.6.50-2.el7.x86_64                   3/8 
  验证中      : mysql-community-client-5.6.50-2.el7.x86_64                  4/8 
  验证中      : mysql-community-libs-5.6.50-2.el7.x86_64                    5/8 
  验证中      : 1:mariadb-devel-5.5.68-1.el7.x86_64                         6/8 
  验证中      : 1:mariadb-libs-5.5.68-1.el7.x86_64                          7/8 
  验证中      : 1:mariadb-5.5.68-1.el7.x86_64                               8/8 

已安装:
  mysql-community-client.x86_64 0:5.6.50-2.el7                                  
  mysql-community-devel.x86_64 0:5.6.50-2.el7                                   
  mysql-community-libs.x86_64 0:5.6.50-2.el7                                    
  mysql-community-server.x86_64 0:5.6.50-2.el7                                  

作为依赖被安装:
  mysql-community-common.x86_64 0:5.6.50-2.el7                                  

替代:
  mariadb.x86_64 1:5.5.68-1.el7          mariadb-devel.x86_64 1:5.5.68-1.el7    
  mariadb-libs.x86_64 1:5.5.68-1.el7    

完毕!
**//第三步安装  mysql-server mysql-devel 发现失败**
[root@localhost zzx]#  yum -y install mysql mysql-server mysql-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.ustc.edu.cn
软件包 mysql-community-client-5.6.50-2.el7.x86_64 已安装并且是最新版本
软件包 mysql-community-server-5.6.50-2.el7.x86_64 已安装并且是最新版本
软件包 mysql-community-devel-5.6.50-2.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost zzx]# rpm -qi mysql-server
未安装软件包 mysql-server 
//第四步:提示一下 这个时候我们就业=要用 rpm -qi mysql-community-devel 

> 软件包 mysql-community-client-5.6.50-2.el7.x86_64 已安装并且是最新版本
>软件包 mysql-community-server-5.6.50-2.el7.x86_64 已安装并且是最新版本
>软件包 mysql-community-devel-5.6.50-2.el7.x86_64 已安装并且是最新版本

[root@localhost zzx]# rpm -qi mysql-community-devel 
Name        : mysql-community-devel
Version     : 5.6.50
Release     : 2.el7
Architecture: x86_64
Install Date: 20201209日 星期三 095559秒
Group       : Applications/Databases
Size        : 19136702
License     : Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field.
Signature   : DSA/SHA1, 20200925日 星期五 135653, Key ID 8c718d3b5072e1f5
Source RPM  : mysql-community-5.6.50-2.el7.src.rpm
Build Date  : 20200923日 星期三 212018秒
Build Host  : pb2-production-el7-06.appad3iad.mysql2iad.oraclevcn.com
Relocations : (not relocatable)
Packager    : MySQL Release Engineering <mysql-build@oss.oracle.com>
Vendor      : Oracle and/or its affiliates
URL         : http://www.mysql.com/
Summary     : Development header files and libraries for MySQL database client applications
Description :
This package contains the development header files and libraries necessary
to develop MySQL client applications.
[root@localhost zzx]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service

//第五步打开数据库 ,然后改密码一直错,注意英文符号,容易出错。

[root@localhost zzx]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.6.50 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, 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> IT技术
    -> update mysql.user set password('123456') where user='root'
    -> 
    -> use mysql;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IT技术

update mysql.user set password('123456') where user='root'

use mysql' at line 1
mysql> quit
Bye

[root@localhost zzx]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.50 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, 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> set password for ‘root’@‘localhost’=password(123456);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘123456’)' at line 1
mysql> You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘123456’)' at line 1
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'You have an error in your SQL syntax' at line 1
   
[root@localhost zzx]# mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@localhost zzx]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.6.50 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, 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> select host,user from user;
ERROR 1046 (3D000): No database selected
mysql> 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
mysql> select host,user from user;
+-----------------------+------+
| host                  | user |
+-----------------------+------+
| 127.0.0.1             | root |
| ::1                   | root |
| localhost             |      |
| localhost             | root |
| localhost.localdomain |      |
| localhost.localdomain | root |
+-----------------------+------+
6 rows in set (0.01 sec)


[root@localhost zzx]# mysql  -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.6.50 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, 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> update user set password=password("123456") where user="root";
Query OK, 4 rows affected (0.03 sec)
Rows matched: 4  Changed: 4  Warnings: 0
//第8步
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
//9步
mysql> exit
Bye
[root@localhost zzx]# mysql  -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.6.50 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, 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> grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
Query OK, 0 rows affected (0.00 sec)

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

mysql> exit
Bye
[root@localhost zzx]# vim /etc/sysconfig/iptables 
[root@localhost zzx]# chkconfig mysqld on
注意:正在将请求转发到“systemctl enable mysqld.service”。
[root@localhost zzx]#


在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值