zoukankan      html  css  js  c++  java
  • mysql安装

    创建用户:

    groupadd mysql
    useradd -m -g mysql mysql -s /sbin/nologin

    下载压缩

    wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz
    tar xzvf mysql-8.0.16-linux-glibc2.12-x86_64.tar -C /usr/local/
    mv /usr/local/mysql-8.0.16-linux-glibc2.12-x86_64 /usr/local/mysql

    修改权限

    chown mysql.mysql /usr/local/mysql/data

    初始化数据库:

    ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

    配置文件

    [mysqld]
    basedir = /usr/local/mysql
    datadir = /usr/local/mysql/data
    port = 3306
    socket = /usr/local/mysql/tmp/mysql.sock
    
    [client]
    default-character-set=utf8
    socket= /usr/local/mysql/tmp/mysql.sock
    
    [mysql]
    default-character-set=utf8
    socket= /usr/local/mysql/tmp/mysql.sock
    

    chmod 777 /usr/local/mysql/tmp/

    配置环境变量

    vi /etc/profile
    export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib
    source /etc/profile

    启动mysql:

    cp mysql.server /etc/init.d/mysql
    service mysql start

    修改密码:

    5.8
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

    5.7
    update mysql.user set authentication_string=password('vabesrb2oy') where user='root';

    5.6:
    update mysql.user set Password=password('vabesrb2oy') where user='root';

    创建用户(8版本需要先创建用户才能授权)

    create user 'lsc'@'%' identified by 'lsc';

    创建仓库

    create database blog DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
    grant all on blog.* to 'lsc'@'%';
    flush privileges;

    查询用户信息

    SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;

    报错:

    ./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
    yum install -y libaio

  • 相关阅读:
    HDU
    纯C++去雾算法
    拓扑排序
    SG 函数初步 HDU 1536 && HDU 1944
    <html>
    XML制作RSS源
    ACM退役前2个月总结
    javascript 的 jasmine 的測试语句
    Vue.js父与子组件之间传参
    $.contents().find设置的data在iframe子页面无法获取值
  • 原文地址:https://www.cnblogs.com/orange-lsc/p/12022072.html
Copyright © 2011-2022 走看看