mysql的安装有多种方法,这里就介绍一下二进制包安装。

[root@node1 ~]# tar xvf mysql-5.7.27-linux-glibc2.12-x86_64.tar

[root@node1 ~]# ll

-rw-r--r--  1 root root  676577280 Sep  3 14:32 mysql-5.7.27-linux-glibc2.12-x86_64.tar
-rw-r--r--  1 7161 31415 644916075 Jun 11 00:09 mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz
-rw-r--r--  1 7161 31415  31651176 Jun 11 00:06 mysql-test-5.7.27-linux-glibc2.12-x86_64.tar.gz

[root@node1 ~]# tar zxvf mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz -C /usr/local/src/

[root@node1 ~]# ln -s /usr/local/src/mysql-5.7.27-linux-glibc2.12-x86_64/bin/* /usr/bin/

[root@node1 ~]# useradd mysql

[root@node1 ~]# mkdir /opt/mysql/

[root@node1 mysql]# vim /opt/mysql/my.cnf

[mysqld]
datadir=/opt/mysql/data
basedir=/opt/mysql
socket=/opt/mysql/mysql.sock
symbolic-links=0

[root@node1 ~]# chown -R mysql.mysql /opt/mysql/

初始化数据库:

# mysqld --defaults-file=/opt/mysql/my.cnf --initialize --user=mysql
2019-10-20T15:14:23.391761Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-10-20T15:14:23.391972Z 0 [ERROR] Can't find error-message file '/opt/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2019-10-20T15:14:23.647941Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-10-20T15:14:23.705942Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-10-20T15:14:23.761481Z 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: 4c79a27e-f34c-11e9-a440-000c29641ef8.
2019-10-20T15:14:23.762286Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-10-20T15:14:23.763231Z 1 [Note] A temporary password is generated for root@localhost: SbGi_Ld2M.0M

启动数据库:

# mysqld_safe --defaults-file=/opt/mysql/my.cnf --user=mysql &
[1] 10083
[root@node1 mysql]# Logging to '/opt/mysql/data/node1.err'.
2019-10-20T15:26:05.609531Z mysqld_safe Starting mysqld daemon with databases from /opt/mysql/data

[root@node1 mysql]# ps -ef|grep mysqld
root      10083   4162  0 23:26 pts/2    00:00:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/opt/mysql/my.cnf --user=mysql
mysql     10211  10083  3 23:26 pts/2    00:00:00 /usr/local/src/mysql-5.7.27-linux-glibc2.12-x86_64/bin/mysqld --defaults-file=/opt/mysql/my.cnf --basedir=/opt/mysql --datadir=/opt/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=node1.err --pid-file=node1.pid --socket=/opt/mysql/mysql.sock
root      10248   4162  0 23:26 pts/2    00:00:00 grep --color=auto mysqld
[root@node1 mysql]# netstat -tlunp|grep mysqld
tcp6       0      0 :::3306                 :::*                    LISTEN      10211/mysqld

[root@node1 ~]# mysql -uroot -p -S /opt/mysql/mysql.sock

Enter password:

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

Your MySQL connection id is 2 Server version: 5.7.27

Copyright (c) 2000, 2019, 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> show databases;
ERROR 1820 (HY000): Unknown error 1820
mysql> show databases;
ERROR 1820 (HY000): Unknown error 1820
mysql> alter user 'root'@'localhost' identified by 'Wpw303@123';
Query OK, 0 rows affected (0.00 sec)

关闭数据库:

# mysqladmin -uroot -pWpw303@123 -S /opt/mysql/mysql.sock shutdown

MySQL二进制包安装的更多相关文章

  1. MySQL二进制包安装及启动问题排查

    环境部署:VMware10.0+CentOS6.9(64位)+MySQL5.7.19(64位)一.操作系统调整 # 更改时区 .先查看时区 [root@localhost ~]# date -R Tu ...

  2. mysql二进制包安装与配置实战记录

    导读 一般中小型网站的开发都选择 MySQL 作为网站数据库,由于其社区版的性能卓越,搭配 PHP .Linux和 Apache 可组成良好的开发环境,经过多年的web技术发展,在业内被广泛使用的一种 ...

  3. ubuntu下mysql二进制包安装

    1.下载对应二进制包 cd /usr/local/srcsudo wget http://dev.mysql.com/downloads/file/?id=465030 2.解压并放在/usr/loc ...

  4. mysql二进制包安装和遇到的问题

    一.编译安装 tar -zxf mysql-5.5.32-linux2.6-x86_64.tar.gz mv mysql-5.5.32-linux2.6-x86_64 /application/mys ...

  5. MySQL二进制包安装简略过程

    l  软件目录 [root@MASTER_03 ~]# mkdir -pv /data/software [root@MASTER_03 ~]# cd /data/software/ [root@MA ...

  6. 二进制包安装MySQL数据库

    1.1二进制包安装MySQL数据库 1.1.1 安装前准备(规范) [root@Mysql_server ~]# mkdir -p /home/zhurui/tools ##创建指定工具包存放路径 [ ...

  7. shell安装MySQL二进制包

    现在解压MySQL二进制包,稍作配置,就能用了,安装速度快,安装来练习最好不过了,哈哈 该脚本只是安装二进制的MySQL包,my.cnf只修改了简单的选项,没有过多进行设置,若朋友们用我的脚本安装作为 ...

  8. Mysql 通用二进制包安装

    通用二进制包安装 注意:这里有严格的平台问题: 使用时:centos5.5版本   (类似Windows下的绿色包) 下载(mirrors.sohu.com/mysql)   直接使用tar 解压到指 ...

  9. liunx系统二进制包安装编译mysql数据库

    liunx系统二进制包安装编译mysql数据库 # 解压二进制压缩包 [root@localhost ~]# tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz -C ...

随机推荐

  1. (七)Redis之持久化之RDB方式

    一.持久化概念 所有的数据都存在内存中,从内存当中同步到硬盘上,这个过程叫做持久化过程. 使用方法: 1. rdb持久化方法:在指定的时间间隔写入硬盘 2.         aof方式:将以日志,记录 ...

  2. (二十一)SpringBoot之集成mybatis:使用mybatis xml

    一.引入maven依赖 <dependencies> <dependency> <groupId>org.springframework.boot</grou ...

  3. Linux MySQL 常见无法启动或启动异常的解决方案

    Linux MySQL 常见无法启动或启动异常的解决方案 在 Linux 上自建 MySQL 服务器,经常遇到各种无法启动或启动后异常的问题,本文列举一些常见问题的解决办法. 注意:以下错误日志提示, ...

  4. Java基础加强-反射机制

    反射的基石 -> Class 类(字节码)/*只要是在源程序中出现的类型,都要各自的Class实例对象,例如:int,int[],void*/如何得到各个字节码对应的实例对象(Class类型) ...

  5. git日常命令

    克隆项目:git clone addr dir 切换分支,分支并没有 git checkout -b production origin/production 分支已存在,单纯切换分支 git che ...

  6. C# 直播录制视频

    //项目引用 ffmpeg.exe 下载地址http://ffmpeg.org/ var time = DateTime.Now; ; //录制分钟 var fileName = Guid.NewGu ...

  7. python将一个字符串写入文件中的编码问题

    python2将一个字符串写入文件中: 1.如果字符串是str类型 # -*- coding:utf-8 -*- txtFile="今天天气不错" name = "1.t ...

  8. Excel 教程一

    俗话说,工欲善其事,必先利其器,那么我们今天就先来看一下这个excel软件的一些主要功能菜单. 一.功能区菜单 功能区菜单主要包括: 文件菜单:  主要用于新建文件,保存文件,另存为文件,打开文件,打 ...

  9. SQL JOB实现数据库同步

    数据库同步是一种比较常用的功能.以下结合我自己的体会整理的,如果有理解不完全或者有误的地方望大牛不理赐教.下面介绍的就是数据库同步的两种方式: 1.SQL JOB的方式  sql Job的方式同步数据 ...

  10. 【python】使用plotly生成图表数据

    安装 在 ubuntu 环境下,安装 plotly 很简单 python 版本2.7+ pip install plotly 绘图 在 plotly 网站注册后,可以直接将生成的图片保存到网站上,便于 ...