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)

     

  • 相关阅读:
    堆和栈的区别
    .net中类(class)与结构(struct)的不同
    CTS、CLS、CLR
    C#和.Net的关系
    装箱(boxing)和拆箱(unboxing)
    三层架构
    属性和public字段的区别(调用set方法为一个属性设值,然后用get方法读取出来的值一定是set进去的值吗?)
    override与重载(overload)的区别
    C#中的委托是什么?事件是不是一种委托?事件和委托的关系。
    json转树状菜单栏
  • 原文地址:https://www.cnblogs.com/flymaster500/p/8532597.html
Copyright © 2011-2022 走看看