zoukankan      html  css  js  c++  java
  • centos 7.0下安装MySQL 5.7.26

    1.下载MySQL 5.7.26安装包,卸载自带MySQL数据库

    yum remove mariadb-libs -y

    yum install -y libaio-devel

    2.上传MySQL 5.7.26安装包,并解压,创建软连接

    gunzip mysql5.7.26linuxglibc2.12x86_64.tar.gz

    tar -xvf mysql-5.7.26-linux-glibc2.12-x86_64.tar 

    ln -s /stage/mysql-5.7.26-linux-glibc2.12-x86_64 /usr/local/mysql

    3.添加用户组,用户,创建目录,修改相关目录权限

    groupadd mysql

    useradd -g mysql mysql

    chown -R mysql.mysql /usr/local/mysql*

    mkdir -p /data/3306/datadir

    mkdir -p /data/3306/binlog

    chown -R mysql.mysql /data*

    4.修改profile

    vi /etc/profile

    export PATH=/usr/local/mysql/bin:$PATH

    source /etc/profile

    5.初始化

    mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/3306/data

    或者

    mysql --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/3306/data

    6.修改配置文件

    vi /etc/my.cnf

    [mysqld]
    user=mysql
    basedir=/usr/local/mysql
    datadir=/data/3306/data
    log_bin=/data/3306/binlog/mysql‐bin
    port=3306
    server_id=7
    socket=/tmp/mysql.sock
    [mysql]
    socket=/tmp/mysql.sock

    7.准备启动脚本

    cd /usr/local/mysql/supportfiles/

    cp /usr/local/mysql/supportfiles/mysql.server  /etc/init.d/mysqld

    vi /etc/init.d/mysqld

    basedir=/usr/local/mysql
    datadir=/data/3306/data

    /etc/init.d/mysqld start

    8.修改密码

    方法一:mysqladmin -uroot -p password

    方法二:alter user root@localhost identified by 'mysql';

    方法三:mysqladmin -uroot -p password mypassword

    方法四:SET PASSWORD = PASSWORD("mysql");

    方法五:SET PASSWORD FOR 'root'@'localhost' = PASSWORD("mysql");

    方法六:update mysql.user set authentication_string=password('mysql') where user='root' and host='localhost';flush privileges;

     

  • 相关阅读:
    「2017 Multi-University Training Contest 7」2017多校训练7
    「2017 Multi-University Training Contest 2」2017多校训练2
    「CF838B」 Diverging Directions
    对拍程序
    ACM中的fread读入
    「UVA10766」Organising the Organisation(生成树计数)
    荣耻
    CCF 201812-3 CIDR合并
    CCF 201909-3 字符画
    CTSC 2017 游戏[概率dp 线段树]
  • 原文地址:https://www.cnblogs.com/orcl-2018/p/12706536.html
Copyright © 2011-2022 走看看