CentOS7下安装mysql-5.7.18

原创 2017年05月11日 18:20:41

本文参考了:

http://blog.csdn.net/peng314899581/article/details/70241976

http://www.cnblogs.com/pythonal/p/6141516.html

1.      官网下载

https://dev.mysql.com/downloads/mysql/



2.将下载的mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar利用FileZila工具放进root中


3.进入:cd /usr/local

创建mysql文件夹:mkdir mysql

复制到mysql中

[root@xxxxx local]#cp /root/mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar./mysql

[root@xxxxx local]#cd mysql

解压tar文件

[root@xxxxx local]#tar –xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar


4.安装

安装顺序rpm -ivh

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

mysql-community-libs-5.7.18-1.el7.x86_64.rpm(依赖于common)

mysql-community-client-5.7.18-1.el7.x86_64.rpm(依赖于libs)

mysql-community-server-5.7.18-1.el7.x86_64.rpm(依赖于common,client)

mysql-community-devel-5.7.18-1.el7.x86_64.rpm(MySQL头文件和库文件)

5.出错

执行第一个rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm 出错


file /usr/share/mysql/czech/errmsg.sys frominstall of mysql-community-common-5.7.18-1.el7.x86_64 conflicts with file frompackage mariadb-libs-1:5.5.44-2.el7.centos.x86_64

这里说的很清楚和mariadb-libs-1:5.5.44-2.el7.centos.x86_64冲突了,执行yum -yremove mariadb-libs-1:5.5.44-2.el7.centos.x86_64,然后再安装,成功!

 

安装server又报错了


缺少perl,执行:yum install perl然后在安装,成功!

6.初始化数据库

[root@heting mysql]# mysqld --initialize--user=mysql

7.修改密码

Mysqld.log中的root@localhost: Sf.Gs=(wH6+r,密码是Sf.Gs=(wH6+r,一定要初始化数据库否则mysqld.log中什么都没有

[root@xxx mysql]# cat /var/log/mysqld.log

2017-05-12T07:59:48.175008Z 0 [Warning]TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).

2017-05-12T07:59:53.343111Z 0 [Warning]InnoDB: New log files created, LSN=45790

2017-05-12T07:59:55.368266Z 0 [Warning]InnoDB: Creating foreign key constraint system tables.

2017-05-12T07:59:55.551715Z 0 [Warning] Noexisting UUID has been found, so we assume that this is the first time thatthis server has been started. Generating a new UUID:fc8d3c8d-36e8-11e7-8783-000c29d8df32.

2017-05-12T07:59:55.564802Z 0 [Warning]Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot beopened.

2017-05-12T07:59:55.575027Z 1 [Note] Atemporary password is generated for root@localhost:Sf.Gs=(wH6+r

[root@xxxx mysql]# systemctl startmysqld.service

[root@xxxx mysql]# mysql -uroot -p

Enter password:   (这里输入初始密码Sf.Gs=(wH6+r)

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

Your MySQL connection id is 3

Server version: 5.7.18

 

Copyright (c) 2000, 2017, Oracle and/or itsaffiliates. All rights reserved.

 

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.

 

mysql> show databases;

ERROR 1820 (HY000): You must reset yourpassword using ALTER USER statement before executing this statement.

mysql> ALTER USER 'root'@'localhost'IDENTIFIED BY 'xxxxx';(这个的xxx是自己设置的新密码)

Query OK, 0 rows affected (0.00 sec)

8.可进入mysql修改密码,退出重新登入

mysql> show databases;

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

| Database           |

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

| information_schema |

| mysql              |

| performance_schema |

| sys                |

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

4 rows in set (0.00 sec)

 

mysql> use mysql

Database changed

mysql> show tables;

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

| Tables_in_mysql           |

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

| columns_priv              |

| db                        |

| engine_cost               |

| event                     |

| func                      |

| general_log               |

| gtid_executed             |

| help_category             |

| help_keyword              |

| help_relation             |

| help_topic                |

| innodb_index_stats        |

| innodb_table_stats        |

| ndb_binlog_index          |

| plugin                    |

| proc                      |

| procs_priv                |

| proxies_priv              |

| server_cost               |

| servers                   |

| slave_master_info         |

| slave_relay_log_info      |

| slave_worker_info         |

| slow_log                  |

| tables_priv               |

| time_zone                 |

| time_zone_leap_second     |

| time_zone_name            |

| time_zone_transition      |

| time_zone_transition_type |

| user                      |

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

31 rows in set (0.00 sec)

可以在修改密码

update user set password = password('1234')where user = 'root';

修改了密码要刷新

flush privileges;# 刷新

退出mysql,重新登陆:

mysql> exit

Bye

[root@xxxx mysql]# mysql -uroot -p

Enter password:

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

Your MySQL connection id is 4

Server version: 5.7.18 MySQL CommunityServer (GPL)

 

Copyright (c) 2000, 2017, Oracle and/or itsaffiliates. All rights reserved.

 

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.

9.在SQLyog里连接操作

(1)开启远程访问(用SQLyog可以访问操作)

[root@xxxx ]# grant all privileges on *.*to 'root' @'%' identified by 'xxx';(xxx自己的mysq密码)

[root@xxxx /]# flush privileges;(刷新)

(2)开启防火墙

先用的

[root@heting mysql]# /sbin/iptables -IINPUT -p tcp --dport 3306 -j ACCEPT

[root@heting mysql]# /etc/rc.d/iptablessave

-bash: /etc/rc.d/iptables: 没有那个文件或目录

发现没有,问题可能涉及没有安装iptables

安装iptables,参考http://www.cnblogs.com/kreo/p/4368811.html

然后再添加mysql

[root@xxx /]# iptables -A INPUT -p tcp--dport 3306 -j ACCEPT()

[root@xxx/]# service iptables save(保存操作)

/etc/sysconfig/iptables-config:行56:IPTABLES_MODULES-ip_nat_ftp: 未找到命令

iptables: Saving firewall rules to/etc/sysconfig/iptables:[  确定  ]

(3)在SQLyog里新建一个连接


MYSQL主机地址填linux的ip地址

先测试连接,再连接,通过上两步后就可以连接了

登陆mysql:

方式一:


方式二:



版权声明:本文为博主原创文章,未经博主允许不得转载。 举报

相关文章推荐

Linux(Centos7)yum安装最新mysql

环境 CentOS 7.1 (64-bit system)MySQL 5.6.24 CentOS 安装 参考:http://www.waylau.com/centos-7-insta...

项目管理实践教程一、工欲善其事,必先利其器【Basic Tools】

今天,我们首先安装一些必须的软件,主要有下面的4个,其中软件1和2使用在服务器机上,软件3和4安装在客户端机上。另外,我们还有用到MSBuild、RoboCopy、WebDeployment等等,在下...

我是如何成为一名python大咖的?

人生苦短,都说必须python,那么我分享下我是如何从小白成为Python资深开发者的吧。2014年我大学刚毕业..

从零开始学Scala(一)——Scala环境搭建与第一行代码

开发环境搭建 安装JDK安装Scala, scala下载页面 下载版本2.12.3安装Intellij idea插件, Intellij idea Scala插件下载 环境搭建 1、...

HTTP 请求头 Header

HTTP 请求头 Header  HTTP请求头概述 (HttpServletRequest) HTTP客户程序(例如浏览器),向服务器发送请求的时候必须指明请求类型(一般是GET或者POST或者HE...

NoSQL开篇——为什么要使用NoSQL

【编者按】NoSQL在2010年风生水起,大大小小的Web站点在追求高性能高可靠性方面,不由自主都选择了NoSQL技术作为优先考虑的方面。今年伊始,InfoQ中文站有幸邀请到凤凰网的孙立先生,为大家分...

MAC下安装及配置CentOs6.5虚拟机

本文记录了在mac下,安装centos6.5虚拟机及添加磁盘的过程

项目管理实践教程二、源代码控制【Source Control Using VisualSVN Server and TortoiseSVN】

在第一篇文章 项目管理实践教程一、工欲善其事,必先利其器【Basic Tools】发布后,根据大家的回复,我需要向大家说明几个问题: 1.为什么要用VisualSVN Server,而不用Sub...

SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)

使用SSM(Spring、SpringMVC和Mybatis)已经有三个多月了,项目在技术上已经没有什么难点了,基于现有的技术就可以实现想要的功能,当然肯定有很多可以改进的地方。之前没有记录SSM整合...

项目管理实践【五】自动编译和发布网站【Using Visual Studio with Source Control System to build and publish website autom

在上一篇教程项目管理实践【三】每日构建【Daily Build Using CruiseControl.NET and MSBuild】 中,我们讲解了如何使用CCNET+MSBuild来自动编译项目...
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)