zoukankan      html  css  js  c++  java
  • mysql5.7的安装

    yum -y install gcc gcc-c++ ncurses ncurses-devel cmake bison

     wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz

    tar -zxvf boost_1_59_0.tar.gz

    mv boost_1_59_0 /usr/local/boost

    tar -xf mysql-5.7.17.tar.gz –C /usr/src/

    groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql

    mkdir -pv /data/mysql

    cd /usr/src/mysql-5.7.17

    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/data/mysql/mysqld.sock -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_BOOST=/usr/local/boost -DMYSQL_USER=mysql -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci

    make 

    make install #编译安装

    chown -R mysql:mysql /usr/local/mysql

    chown -R mysql:mysql /data

    cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

    chmod +x /etc/init.d/mysqld

    ln -s /usr/local/mysql/bin/* /usr/local/bin/

    chkconfig --add mysqld

    chkconfig mysqld on

    cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

    初始化

    /usr/local/mysql/bin/mysqld  --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql(如果这里报错,就指定为--datadir=/usr/local/mysql/data)  

    --initialize为随机生成mysql密码,注意初始化最后一行是root用户密码(例如root@localhost: ,5j1Qj_LLAek)

    /etc/init.d/mysqld start

    mysql5.7以上密码重置方法

    vim /etc/my.cnf 加入一行mysqld--skip-grant-tables

    mysql 登录 use mysql;

    update user set authentication_string=password("new_pass") where user="root";

    flush privileges;

    如果报错ERROR 1820 (HY000): You must reset your password using ALTER USER statement

    SET PASSWORD = PASSWORD('123456');

    如果出现ERROR 1819 (HY000): Your password does not satisfy the current policy requirements;

    set global validate_password_policy=0; set global validate_password_mixed_case_count=2;(取消密码强度)

    SET PASSWORD = PASSWORD('123456');

    Mysql5.7.17开启远程连接

    mysql -uroot –p

    use mysql;

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

    flush privileges;

    select host,user from user;(查看所有用户)

  • 相关阅读:
    web.xml配置详解(转载)
    http协议无状态中的 "状态" 到底指的是什么?!(转载)
    sublime配置python运行环境
    Eclipse下载安装教程
    局域网访问文件共享了访问不了解决方法
    ThreadLocal实现线程级上下文
    Spring中ApplicationEvent和ApplicationListener封装
    MySQL根据出生日期计算年龄的五种方法比较
    常用正则
    java.lang.OutOfMemoryError: PermGen space有效解决方法
  • 原文地址:https://www.cnblogs.com/jiayannvwang/p/9494055.html
Copyright © 2011-2022 走看看