zoukankan      html  css  js  c++  java
  • 【MySQL】MySQL基于二进制文件安装

    本篇主要演示在Linux上使用二进制文件进行MySQL的安装,具体过程如下:

    1、下载二进制压缩文件mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz;

    [root@strong ~]# ll /u01/
    total 1499868
    drwx------. 2 root root     16384 Feb 27 20:53 lost+found
    -rw-r--r--. 1 root root 641798603 Mar  3 20:08 mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
    -rw-r--r--. 1 root root 894037512 Mar  3 20:08 mysql-cluster-gpl-7.5.9-linux-glibc2.12-x86_64.tar.gz
    [root@strong ~]#

    2、创建MySQL用户和组;

    [root@strong ~]# groupadd mysql
    [root@strong ~]# useradd -r -g mysql -s /bin/false mysql

    3、解压缩MySQL压缩包;

    [root@strong u01]# cd /usr/local/
    [root@strong local]# tar zxvf /u01/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz 
    [root@strong local]# ln -s mysql-5.7.21-linux-glibc2.12-x86_64/ mysql
    [root@strong local]# cd mysql
    [root@strong mysql]# mkdir mysql-files
    [root@strong mysql]# chown mysql:mysql mysql-files/
    [root@strong mysql]# chmod 750 mysql-files/

    4、设置MySQL数据库;

    [root@strong mysql]# ./bin/mysqld --initialize --user=mysql
    2018-03-04T02:28:06.686061Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2018-03-04T02:28:07.218770Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2018-03-04T02:28:07.361069Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2018-03-04T02:28:07.431017Z 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: aca9194e-1f53-11e8-9c95-000c29d02424.
    2018-03-04T02:28:07.438362Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
    2018-03-04T02:28:07.440935Z 1 [Note] A temporary password is generated for root@localhost: (owD!npaZ5dd --临时密码

    5、启动MySQL并重置root密码;

    [root@strong mysql]# ./bin/mysqld_safe --user=mysql &
    [1] 2696
    [root@strong mysql]# Logging to '/usr/local/mysql/data/strong.mysql.com.err'.
    2018-03-04T02:49:57.520487Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
    
    [root@strong mysql]# ./bin/mysql -uroot -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 2
    Server version: 5.7.21
    
    Copyright (c) 2000, 2018, 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> alter user 'root'@'localhost' identified by 'root';  --修改密码
    Query OK, 0 rows affected (0.01 sec)

    6、拷贝MySQL.server;

    [root@strong mysql]# cp support-files/mysql.server /etc/init.d/mysql.server

    7、查看MySQL服务状态;

    [root@strong mysql]# service mysql.server status
     SUCCESS! MySQL running (2766)
    [root@strong mysql]# ps aux |grep mysql
    root       2696  0.0  0.3 113268  3080 pts/0    S    10:49   0:00 /bin/sh ./bin/mysqld_safe --user=mysql
    mysql      2766  0.1 19.1 1119688 191228 pts/0  Sl   10:49   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=strong.mysql.com.err --pid-file=strong.mysql.com.pid
    root       2913  0.0  0.2 112668  2216 pts/0    R+   10:57   0:00 grep --color=auto mysql
    [root@strong mysql]# 

    8、创建my.cnf配置文件;

    [root@strong mysql]# more /etc/my.cnf 
    [mysqld]
    
    basedir=/usr/local/mysql
    datadir=/usr/local/mysql/data
    
    character_set_server=utf8
    
    
    [mysql]
    
    default-character_set=utf8

    至此,MySQL安装完毕;

  • 相关阅读:
    HDOJ 5294 Tricks Device 最短路(记录路径)+最小割
    国家人工智能(AI)的美好前景
    预防埃博拉病毒感染的试验疫苗投入人体试验
    MySQL同步复制搭建方法指南详细步骤
    正则表达式,用相反的方式过滤掉特殊字符
    Linux入门教程
    Linux:-bash: ***: command not found
    linux命令大全
    linux下打开、关闭tomcat,实时查看tomcat运行日志
    chmod u+x ./j2sdk-1_4_2_04-linux-i586.bin的含义
  • 原文地址:https://www.cnblogs.com/alen-liu-sz/p/12975685.html
Copyright © 2011-2022 走看看