ITeye博客

mysql在liunx下的安装手册

bjameng · 2015-04-27 20:10 · 数据库 · 数据库 · Markdown

  1. 安装准备

      cd /opt
      mkdir mysql
    
      mv mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz  ./mysql
      cd mysql
      tar zxvf mysql-5.6.23-linux-glibc2.5-x86_64.tar.gz
      cd mysql-5.6.23-linux-glibc2.5-x86_64
      ln -s /opt/mysql/mysql-5.6.23-linux-glibc2.5-x86_64 /usr/local/mysql
      cd /usr/local/mysql
      groupadd mysql
      useradd mysql -d /home/mysql -g mysql
    
  2. 改变目录所有者

    chown -R mysql:mysql /usr/local/mysql
    
  3. 初始化数据库

    cd /usr/local/mysql/scripts
    ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
    
  4. 注册为服务

    cd /usr/local/mysql/support-files
    cp mysql.server /etc/rc.d/init.d/mysql
    
  5. 使用默认配置文件

    cp my-default.cnf /etc/my.cnf
    
  6. 让chkconfig管理mysql服务

    chkconfig --add mysql
    
  7. 开机启动

    chkconfig mysql on
    
  8. 修改mysql的my.cnf文件,用安装包中的my.cnf覆盖/etc/my.cnf

  9. 将mysql的bin加入到path中

    vi /etc/profile
    #加入以下内容
    PATH=/usr/local/mysql/bin:$PATH
    export PATH
    #退出vi,执行  
    source /etc/profile
    
  10. 启动MySQL服务

    service mysql start
    
  11. 配置用户密码和远程访问权限

    mysql -uroot  
    SET PASSWORD = PASSWORD('123456');
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
    
  12. 常用操作:

    启动mysql
    service mysql start
    停止mysql
    service mysql stop
    登录mysq:
    mysql -uroot -p 123456
    
  13. 安装下载地址

    http://pan.baidu.com/s/1bnfeC8Z
    nb6h
    

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。