zoukankan      html  css  js  c++  java
  • 【 Mysql 】 2进制安装和简单优化

    mysql 2进制安装和简单优化

    mkdir /home/fly/tools
    cd /fly/tools/
    rz -y #上传
    ls
    useradd -s /sbin/nologin -M mysql #建用户
    id mysql
    tar xf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz#解压
    mkdir /application
    mv mysql-5.6.39-linux-glibc2.12-x86_64 /application/ #相当于编译安装 速度块
    cd /application/
    ln -s /application/mysql-5.6.39-linux-glibc2.12-x86_64 /application/mysql #软连接
    ll /application/mysql/
    /application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql #初始化
    yum install -y perl perl-devel #根据提示看是否需要这个包
    chown -R mysql.mysql /application/mysql #配置权限
    vi /etc/hosts #解析主机名 echo "192.168.1.65 mysql_66" >>/etc/hosts
    yum install -y libaio* #看提示是否需要这2个包
    yum install -y libnuma*
    /application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql #安装成功会返回2个ok
    echo $? #看是否成功 返回0成功
    /application/mysql//bin/mysqld_safe &(启动)
    cp /application/mysql/support-files/my-default.cnf /etc/my.cnf #配置/etc/init.d/mysqld 启动
    sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /application/mysql/support-files/mysql.server
    cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld
    /etc/init.d/mysqld start #启动
    Starting MySQL.Logging to '/application/mysql/data/mysql_66.err'.
    ... SUCCESS!
    lsof -i :3306
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    mysqld 1492 mysql 10u IPv6 13492 0t0 TCP *:mysql (LISTEN)
    cp /application/mysql/bin/* /usr/local/sbin/
    mysql
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 1
    Server version: 5.6.39 MySQL Community Server (GPL)

    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> exit
    Bye
    mysqladmin -uroot password 123456 #设置密码
    Warning: Using a password on the command line interface can be insecure.
    mysqladmin -uroot -p123456 password 123456 #修改密码
    Warning: Using a password on the command line interface can be insecure.
    mysql -uroot -p123456 #进入数据库
    Warning: Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 6
    Server version: 5.6.39 MySQL Community Server (GPL)

    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> show databases; #优化
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    | mysql |
    | performance_schema |
    | test |
    +--------------------+
    4 rows in set (0.05 sec)

    mysql> drop database test;
    Query OK, 0 rows affected (0.10 sec)

    mysql> show databases;
    +--------------------+
    | Database |
    +--------------------+
    | information_schema |
    | mysql |
    | performance_schema |
    +--------------------+
    3 rows in set (0.00 sec)

    mysql> select user,host from mysql.user;
    +------+-----------+
    | user | host |
    +------+-----------+
    | root | 127.0.0.1 |
    | root | ::1 |
    | | localhost |
    | root | localhost |
    | | mysql\_66 |
    | root | mysql\_66 |
    +------+-----------+
    6 rows in set (0.00 sec)

    mysql> drop user 'root'@'::1';
    Query OK, 0 rows affected (0.04 sec)

    mysql> drop user ''@'localhost';
    Query OK, 0 rows affected (0.00 sec)


    mysql> drop user ''@'mysql\_66';
    Query OK, 0 rows affected (0.00 sec)

    mysql> select user,host from mysql.user;
    +------+-----------+
    | user | host |
    +------+-----------+
    | root | 127.0.0.1 |
    | root | localhost |
    | root | mysql\_66 |
    +------+-----------+
    3 rows in set (0.00 sec)

    mysql> drop user 'root'@'mysql\_66';
    Query OK, 0 rows affected (0.03 sec)

    For server side help, type 'help contents'

    mysql> flush privileges
    -> ;
    Query OK, 0 rows affected (0.00 sec)

     

  • 相关阅读:
    递延收益的主要账务处理
    少数股东权益
    一揽子交易中处置价款与净资产账面价值差额为什么计入其他综合收益
    为什么权益法下其他综合收益合并时要计入投资收益
    R语言代写实现MCMC中的Metropolis–Hastings算法与吉布斯采样
    加速R语言代码的策略
    R语言代写:EM算法和高斯混合模型的实现
    R语言代写进行网站评论文本数据挖掘聚类
    R语言代写对推特数据进行文本情感分析
    WEKA代写文本挖掘分析垃圾邮件分类模型
  • 原文地址:https://www.cnblogs.com/flymaster500/p/8532597.html
Copyright © 2011-2022 走看看