zoukankan      html  css  js  c++  java
  • Debian 8.2 下安装MySQL5.7.9 Generic Binaries

    安装过程参考了Installing MySQL on Unix/Linux Using Generic Binaries
    首先检查是否安装libaio

    shell> apt-cache search libaio # search for info
    shell> apt-get install libaio1 # install library

    然后安装

    shell> groupadd mysql
    shell> useradd -r -g mysql -s /bin/false mysql
    shell> cd /usr/local
    shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
    shell> ln -s full-path-to-mysql-VERSION-OS mysql
    shell> cd mysql
    shell> mkdir mysql-files
    shell> chmod 770 mysql-files
    shell> chown -R mysql .
    shell> chgrp -R mysql .
    shell> bin/mysql_install_db --user=mysql    # Before MySQL 5.7.6
    shell> bin/mysqld --initialize --user=mysql # MySQL 5.7.6 and up
    shell> bin/mysql_ssl_rsa_setup              # MySQL 5.7.6 and up
    shell> chown -R root .
    shell> chown -R mysql data mysql-files
    shell> bin/mysqld_safe --user=mysql &
    # Next command is optional
    shell> cp support-files/mysql.server /etc/init.d/mysql.server

    我使用了非默认目录 /opt/mysql/ 所以安装过程稍有不同

    sudo apt-cache search libaio
    sudo apt-get install libaio1
    
    sudo groupadd mysql
    sudo useradd -r -g mysql -s /bin/false mysql
    
    cd /opt/
    sudo mkdir mysql
    sudo mv ~/Downloads/mysql-5.7.9-linux-glibc2.5-x86_64 /opt/mysql/
    sudo ln -s /opt/mysql/mysql-5.7.9-linux-glibc2.5-x86_64/ mysql
    cd mysql
    sudo mkdir mysql-files
    sudo mkdir data #这个目录需要先创建并设置权限
    sudo chmod 770 mysql-files
    sudo chown -R mysql:mysql .
    sudo ./bin/mysqld --initialize --user=mysql --datadir=/opt/mysql/mysql/data #需要额外指定data目录路径, 这一步会生成root用户临时密码, 注意保存
    sudo ./bin/mysql_ssl_rsa_setup --datadir=/opt/mysql/mysql/data #sudo, 并且指定路径
    # 重新设置权限为root, 仅留data和mysql-files目录
    sudo chown -R root:root .
    sudo chown -R mysql:mysql data mysql-files
    # 启动mysql服务
    sudo ./bin/mysqld_safe --user=mysql &
    # 检查是否存在进程
    ps aux|grep mysqld
    # 第一次登录, 输入之前的密码, 并使用 set password = password('passwd'); 设置新密码
    sudo ./bin/mysql -u root -p 
    # 使用mysqladmin 查看版本信息
    sudo ./bin/mysqladmin -u root -p version
    # 关闭/停止服务
    sudo ./bin/mysqladmin -u root -p shutdown
    # 创建服务脚本
    sudo cp support-files/mysql.server /etc/init.d/
    # 启动服务
    sudo /etc/init.d/mysql.server start
    # 或者
    sudo systemctl start mysql.server
    # 如果出现 Failed to restart network.service: Unit network.service failed to load: No such file or directory. 错误
    sudo systemctl enable mysql.server
    # 然后就可以启动了
    sudo systemctl start mysql.server
  • 相关阅读:
    python 中文文档地址总结
    清除celery 任务队列
    celery work logging 问题
    mysql 数据库 存储数据类型
    python 补0的方法
    lunix 命令积累
    python3 import Crypto 失败的解决办法 (AES对称加密使用 模块)
    从excel 获取内容 模块:xlrd
    api h5 sdk 接入的说明
    Excel 打开两个单独的页面
  • 原文地址:https://www.cnblogs.com/milton/p/5006032.html
Copyright © 2011-2022 走看看