MySQL-5.5.48二进制安装

#创建MySQL软件目录及用户组
 
    mkdir /server/tools -p
    cd /server/tools
    useradd -s /sbin/nologin -M mysql
#下载解压,拷贝数据库目录
    #wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.48-linux2.6-x86_64.tar.gz
    tar -zxvf mysql-5.5.48-linux2.6-x86_64.tar.gz
    cp -r mysql-5.5.48-linux2.6-x86_64 /usr/local/mysql-5.5.48
    ln -s /usr/local/mysql-5.5.48/ /usr/local/mysql
#设置MySQL数据库目录权限
chown -R mysql.mysql /usr/local/mysql/data
#初始化MySQL数据库 
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql
\cp /usr/local/mysql/support-files/my-huge.cnf /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
#MySQL启动加执行权限
 
    chmod +x /etc/init.d/mysqld
    /etc/init.d/mysqld start
#配置MySQL环境变量
    echo 'PATH="/usr/local/mysql/bin:$PATH"' >> /etc/profile
    source /etc/profile
#设置MySQL开启自启动 
    chkconfig mysqld on
    chmod -R 4777 /tmp
    /etc/init.d/iptables stop
    chkconfig iptables off
#建立WIKI数据库
    [root@master support-files]# mysqladmin  -u root password '123' 
    mysql> select user,host from user;
    mysql> drop user 'root'@master;
    mysql> show databases;
    mysql> create database wiki; 
    mysql> grant all on wiki.* to wiki@'192.168.2.%' identified by 'wiki';
    mysql> flush privileges;

 

posted @ 2017-05-04 20:32  sunmmi  阅读(278)  评论(0)    收藏  举报