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:

方式一:


方式二:



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

centOS 7安装MySQL5.5

一、从官网下载MySQL 下载地址:http://dev.mysql.com/downloads/mysql/ 名称:MySQL-5.5.42-1.el7.x86_64.rpm-bundle.ta...

centos7.2环境编译安装mysql5.5.48

一.安装cmake编译工具 跨平台编译器 查看是否已经安装了gcc # rpm -qa | grep gcc # yum install -y gcc-c++ # yum install -y cma...

Centos7下安装Mysql5.7.15

Centos7下安装mysql-5.7.15-1.el7.x86_64.rpm-bundle.tar 转载:http://jingyan.baidu.com/article/93f9803f010d...

Centos7安装mysql5.7社区版

Centos7安装mysql5.7社区版
  • valsong
  • valsong
  • 2016年11月20日 22:50
  • 508

CentOS7下安装mysql-5.7.18

CentOS7下安装mysql-5.7.18 前言:楼主以前一直用的CentOs6.6,准备在这个环境上安装一个最新版本的mysql-5.7.18. 于是就开始下载mysql-5.7.18的rpm安装...

CENTOS7使用rpm方式安装mysql5.7.18

1、# yum install libaio //mysql依赖包 2、# rpm -ivh mysql-community-libs-5.7.17-1.el6.x86_64.rpm  mysql-c...

sqlserver 批量更新表中的值 把某个字段更新成另外一个表的某个字段

sqlserver 批量更新表中的值 把某个字段更新成另外一个表的某个字段UPDATE dbo.by_product SET weight=dbo.by_category.weight FROM db...

vim VI E138: Can't write viminfo file /*/.viminfo!

删除对应用户目录下的文件,执行如下命令 rm -f .viminf*.tmp 产生原因是:vim打开文件后,没有进行任何编辑后退出,或者编辑后保存退出...

(一) CentOS7下RPM安装MYSQL-5.7.18

本人今天首次在CENTOS7下面安装MYSQL-5.7.18(截止今天这是最新版本), 遇到的mysqladmin 无法设置密码的问题...
  • crynono
  • crynono
  • 2017年05月30日 09:42
  • 499

centos7下安装mysql5.7.18

摘要: 本文简单介绍了centos7版本下安装mysql数据库。由于centos7和之前的版本差异较大,所以配置也੍... 1、安装环境介绍    操作系统:CentOS7 64位,MIN...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:CentOS7下安装mysql-5.7.18
举报原因:
原因补充:

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