• centeros 安装mysql


    1. 获得二进制文件 
    wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz

    2. 加压到 /usr/local/mysql 目录(或者解压到当前目录然后做软链接到/usr/local/mysql)
    mkdir /usr/local/mysql
    tar -xvf mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
    mv mysql-5.7.10-linux-glibc2.5-x86_64/* /usr/local/mysql/

    3. 创建 /usr/local/mysql/data 目录
    mkdir /usr/local/mysql/data

    4. 创建mysql用户和修改软件的权限
    groupadd mysql
    useradd -r -g mysql mysql -s /sbin/nologin (创建mysql用户并设置不可登录)
    chown -R mysql.mysql /usr/local/mysql/

    5. 初始化数据(切换当前目录到/usr/local/mysql)
    bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
    2016-01-20 02:47:35 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
    2016-01-20 02:47:45 [WARNING] The bootstrap log isn't empty:
    2016-01-20 02:47:45 [WARNING] 2016-01-19T18:47:36.732678Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
    2016-01-19T18:47:36.750527Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
    2016-01-19T18:47:36.750560Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

    6. 复制配置文件到 /etc/my.cnf
    cp -a ./support-files/my-default.cnf /etc/my.cnf (如果问是否替换选择Y)

    7. mysql的服务脚本放到系统服务中
    cp -a ./support-files/mysql.server /etc/init.d/mysqld
    service mysqld start 
    cat /root/.mysql_secret
    # Password set for user 'root@localhost' at 2016-01-20 03:22:59 
    Tl:iRfEhRlQ6
    bin/mysql -uroot -p(输入Tl:iRfEhRlQ6)
    [root@c12 mysql57]# ./bin/mysqladmin -u root -p password
    Enter password: 
    New password: 
    Confirm new password: 
    Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
    mysql> select version();
    +-----------+
    | version() |
    +-----------+
    | 5.7.8-rc |
    +-----------+
    1 row in set (0.00 sec)

  • 相关阅读:
    call_user_func和call_user_func_array的区别
    25行实现文件上传功能(PHP)
    PHP 结合MYSQL简单的实现了Todo List 功能
    向ASP.NET自定义控件中嵌入CSS资源
    模态子窗口不执行page_load
    oracle一次插入多条数据
    转载:数据库表结构设计方法及原则
    Js中的window.parent ,window.top,window.self
    在一个JS文件中包含中文字符串通过innerHTML输出后中文乱码
    转载:数据库表结构设计方法及原则
  • 原文地址:https://www.cnblogs.com/lemonlemontree/p/7489838.html
Copyright © 2020-2023  润新知