• CentOS 6.5下二进制安装 MySQL 5.6


    CentOS 6.5 二进制安装MySQL 5.6

    1:查看系统版本

    [root@10-4-5-9 mysql]# cat /etc/redhat-release
    CentOS release 6.5 (Final)
    

    2:下载MySQL5.6二进制包

    #wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.20-linux-glibc2.5-i686.tar.gz
    

    3:添加用户和组

    #groupadd mysql
    #useradd -g mysql mysql
    

    4:安装mysql到/usr/local/mysql下

    #cd /usr/local
    
    #tar zxvf /{MySQL5.6_path}/mysql-{version}.tar.gz
    
    例如我的配置路径为:
    #cd /usr/local
    #tar zxvf /root/mysql-5.6.20-linux-glibc2.5-i686.tar.gz
    

    5:修改解压后文件夹名为 mysql

    #mv mysql-5.6.20-linux-glibc2.5-i686 mysql

    6:修改mysql的各级文件夹和文件的创建者、创建组为mysql(注意语句后面有个.

    cd mysql
    chown -R mysql .
    chgrp -R mysql .

    7:至此mysql已经安装完了,但还需要初始化,初始化mysql表、test表、infomation表等。

    #scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

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

     

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

      

    PS:该步骤有可能会报错误
    安装需要的包即可:libstdc++.so.6和libaio.so.1和libncurses.so.5

      

    8:修改配置文件

    [root@10-4-5-9 mysql]# cp my.cnf /etc/my.cnf
    /usr/local/mysql
    [root@10-4-5-9 mysql]# vi /etc/my.cnf
    
    [mysqld]中添加:
    
    basedir = /usr/local/mysql
    datadir = /usr/local/mysql/data
    port = 3306
    server_id = 1
    

      

    9:启动mySQL服务

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

     

    #service mysqld start
    

      

    10:登陆MySQL并且删除空用户

    mysql> SELECT user,host,password FROM mysql.user;
    +------+-----------+----------+
    | user | host      | password |
    +------+-----------+----------+
    | root | localhost |          |
    | root | 10-4-5-9  |          |
    | root | 127.0.0.1 |          |
    | root | ::1       |          |
    |      | localhost |          |
    |      | 10-4-5-9  |          |
    +------+-----------+----------+
    6 rows in set (0.00 sec)
    
    mysql> UPDATE mysql.user set password = PASSWORD('gechong') WHERE user = 'root';
    
    mysql> DROP USER ''@localhost;
    
    mysql> FLUSH PRIVILEGES;
    

      

    
    
    
  • 相关阅读:
    react萌新的读书笔记(一)
    python 读取目录下的文件
    scrapy爬虫入门
    iPad和iPhone如何保护自己的隐私?
    郭盛华动真格了!新公司获百亿融资,网友:还招人不
    僵尸网络瞄准Linux服务器
    中美黑客谁更强?揭秘郭盛华与凯文的传奇故事
    VMware新致命漏洞,黑客可远程控制你的系统
    中国两大网络守护神,为祖国默默付出着,向他们致敬!
    Web应用程序已成为黑客的首要目标
  • 原文地址:https://www.cnblogs.com/xiaoit/p/3988640.html
Copyright © 2020-2023  润新知