ubuntu13.10安装二进制mysql

来源:互联网 发布:gillian murphy 知乎 编辑:程序博客网 时间:2024/06/04 21:28
1.下载mysql压缩包

http://dev.mysql.com/downloads/mysql/#downloads

-------文章写的很详细------

http://wangyan.org/blog/install-mysql-from-binaries.html

2.安装

--先安装installlibaio-dev

sudo apt-get install libaio-dev

3.切换到root用户

# groupadd mysql
# useradd -r -g mysql mysql

------ 解压到/usr/local/,解压到其它路径以后还要改配置文件mysql.server  ---

cd /usr/local/ 

 tar zxvf mysql-5.5.13-linux2.6-i686.tar.gz 

ln -s mysql-5.5.15-linux2.6-i686 mysql

# cd /usr/local/

 #    chown -R mysql .

 #    chgrp -R mysql .

#   cd /usr/local/mysql

 #    scripts/mysql_install_db --user=mysql
 #     chown -R root . 

 #     chown -R mysql data

----建立软连接,可以通过mysql直接访问数据库

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

4.安装后配置

       (1): 复制my-medium.cnf ,mysql.server脚本

         # cd  /usr/local/mysql 

         #  cp support-files/my-medium.cnf /etc/my.cnf 

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

      (2):初始化root密码:

         #    cd  /usr/local/mysql/bin

          #  ./mysqladmin -u root password 'new password'

     (3):查看状态:
           sudo service mysql.server [status|start|stop]  

       (4).开机启动
               sudo update-rc.d -f mysql.server defaults
        (5)取消开机启动
             sudo update-rc.d -f mysql.server remove 

        (6)允许远程访问,进到mysql里
          #mysql:

             ---允许任何ip访问-----

           GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

           FLUSH PRIVILEGES;

          ----允许192.168.1.18远程访问:

        GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.18' IDENTIFIED BY 'password' WITH GRANT OPTION;
            FLUSH PRIVILEGES;