mysql5.7二进制编译包的安装

Wesley13
• 阅读 566

mysql5.7的二进制编译包安装方法与5.6版本有些地方不同,下面将安装方法记录,方便后期查看

  • 解压并移动目录至/usr/local,重命名为mysql5.7

    [root@localhost src]# tar -zxvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

    [root@localhost src]# mv mysql-5.7.17-linux-glibc2.5-x86_64 ../mysql5.7

  • 创建目录,修改权限

    [root@localhost mysql5.7]# mkdir /data/mysql5.7/ [root@localhost mysql5.7]# chown -R mysql.mysql /data/mysql5.7/

  • 初始化

    [root@localhost mysql5.7]# ./bin/mysqld --initialize --user=mysql --datadir=/data/mysql5.7 2017-12-14T14:18:32.479547Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-12-14T14:18:32.479648Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2017-12-14T14:18:32.479655Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode was not set. 2017-12-14T14:18:32.479775Z 0 [ERROR] Error message file '/usr/local/mysql/share/english/errmsg.sys' had only 886 error messages, but it should contain at least 1081 error messages. Check that the above file is the right version for this program! 2017-12-14T14:18:44.095382Z 0 [Warning] InnoDB: New log files created, LSN=45790 2017-12-14T14:18:48.210236Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-12-14T14:18:48.278351Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: b38a0c90-e0d9-11e7-97da-000c29d081f5. 2017-12-14T14:18:48.700210Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2017-12-14T14:18:48.703111Z 1 [Note] A temporary password is generated for root@localhost: xTA5l2(ATjof

    最后这串字符"xTA5l2(ATjof"是mysql数据库初始化的root密码

  • 创建密钥

    [root@localhost mysql5.7]# ./bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql5.7/ Generating a 2048 bit RSA private key ..................................+++ .............+++

    writing new private key to 'ca-key.pem'

    Generating a 2048 bit RSA private key ............................+++ ...........................+++

    writing new private key to 'server-key.pem'

    Generating a 2048 bit RSA private key ..............................+++ .............+++

    writing new private key to 'client-key.pem'

  • 修改配置文件(这里原本已经有/etc/my.cnf了,后续直接指定新的配置文件)

    [root@localhost mysql5.7]# cp support-files/my-default.cnf /etc/my7.cnf [root@localhost mysql5.7]# vi /etc/my7.cnf 修改 basedir和datadir参数即可

  • 命令行模式启动mysql5.7

    [root@localhost mysql5.7]# ./bin/mysqld_safe --defaults-file=/etc/my7.cnf --user=mysql & [1] 5566 [root@localhost mysql5.7]# 2017-12-14T14:29:10.302174Z mysqld_safe Logging to '/data/mysql5.7/localhost.localdomain.err'. 2017-12-14T14:29:10.305015Z mysqld_safe Logging to '/data/mysql5.7/localhost.localdomain.err'. 2017-12-14T14:29:10.341094Z mysqld_safe Starting mysqld daemon with databases from /data/mysql5.7

  • 验证

    [root@localhost mysql5.7]# ps aux | grep mysqld root 5566 0.0 0.1 113268 1592 pts/0 S 22:29 0:00 /bin/sh ./bin/mysqld_safe --defaults-file=/etc/my7.cnf --user=mysql mysql 5685 5.6 12.8 1119056 183688 pts/0 Sl 22:29 0:00 ./bin/mysqld --defaults-file=/etc/my7.cnf --basedir=/usr/local/mysql5.7 --datadir=/data/mysql5.7 --plugin-dir=/usr/local/mysql5.7/lib/plugin --user=mysql --log-error=/data/mysql5.7/localhost.localdomain.err --pid-file=/data/mysql5.7/localhost.localdomain.pid root 5715 0.0 0.0 112676 976 pts/0 S+ 22:29 0:00 grep --color=auto mysqld

  • 设置mysql密码

    使用初始密码登录,并修改密码

    [root@localhost mysql5.7]# /usr/local/mysql5.7/bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.17

    Copyright (c) 2000, 2016, 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 = password('123456'); Query OK, 0 rows affected, 1 warning (0.00 sec)

    mysql> exit Bye

    用新密码重新登录

    [root@localhost mysql5.7]# /usr/local/mysql5.7/bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.7.17 MySQL Community Server (GPL)

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

说明

  1. 如果当前系统已经运行了一个mysql,那么启动新配置的mysql5.7将回立即关闭。

    [root@localhost mysql5.7]# 2017-12-14T14:27:52.822754Z mysqld_safe Logging to '/data/mysql5.7/localhost.localdomain.err'. Logging to '/data/mysql5.7/localhost.localdomain.err'. 2017-12-14T14:27:52.929283Z mysqld_safe Starting mysqld daemon with databases from /data/mysql5.7 2017-12-14T14:27:57.359819Z mysqld_safe mysqld from pid file /data/mysql5.7/localhost.localdomain.pid ended

    [1]+ 完成 ./bin/mysqld_safe --defaults-file=/etc/my7.cnf --user=mysql

  2. 不知道mysql数据库root的密码

    1. 修改配置文件 vi /etc/my7.cnf 在[mysqld]下面加一行 skip-grant-tables 保存后重启mysql

    2. 修改密码 [root@localhost mysql5.7]# /usr/local/mysql/bin/mysql -uroot mysql> use mysql; mysql> update user set authentication_string=password('123333') where user='root';

    3. 重新修改配置文件,去除第1步添加的行

    4. 重启mysql服务生效

下载地址 http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Jacquelyn38 Jacquelyn38
2年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Wesley13 Wesley13
2年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
2年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
2年前
Android蓝牙连接汽车OBD设备
//设备连接public class BluetoothConnect implements Runnable {    private static final UUID CONNECT_UUID  UUID.fromString("0000110100001000800000805F9B34FB");
Stella981 Stella981
2年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
2年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
为什么mysql不推荐使用雪花ID作为主键
作者:毛辰飞背景在mysql中设计表的时候,mysql官方推荐不要使用uuid或者不连续不重复的雪花id(long形且唯一),而是推荐连续自增的主键id,官方的推荐是auto_increment,那么为什么不建议采用uuid,使用uuid究
Python进阶者 Python进阶者
3个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这