zoukankan      html  css  js  c++  java
  • Debian9解压安装MySQL(版本5.7.31)

    一、下载

    MySQL下载官网:https://dev.mysql.com/downloads/mysql

    根据目标主机的型号官网下载对应的mysql安装包,安装类型和名字如下:

    mysql-server_5.7.31-1debian9_amd64.deb-bundle.tar

    二、解压

    tar -xvf mysql-server_5.7.31-1debian9_amd64.deb-bundle.tar

    三、安装

    根据需要安装必要的deb包,可以用dpkg --info 指定的包.deb查看依赖

    1、先安装依赖

    apt install libaio1 libnuma1 libmecab2 -y

    2、然后依次按以下的顺序安装

    (1)dpkg -i mysql-common_5.7.31-1debian9_amd64.deb
    (2)dpkg -i mysql-community-client_5.7.31-1debian9_amd64.deb
    (3)dpkg -i mysql-client_5.7.31-1debian9_amd64.deb
    (4)dpkg -i mysql-community-server_5.7.31-1debian9_amd64.deb(注意:这一步,需要设置MySQL的root密码,步骤是第3步)
    (5)dpkg -i mysql-server_5.7.31-1debian9_amd64.deb

    3、设置密码

    4、确认密码

    四、配置

    如果需要远程访问MySQL,修改配置,默认只能本地访问

    cd /etc/mysql/mysql.conf.d/

    vim mysqld.cnf

    [mysqld]
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    datadir         = /var/lib/mysql
    log-error       = /var/log/mysql/error.log
    # By default we only accept connections from localhost
    bind-address    = 127.0.0.1 # 修改为0.0.0.0即可
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    
    # 字符编码设置为utf8
    character_set_server = utf8
    init_connect = 'SET NAMES utf8'

    1、重启

    systemctl restart mysql

    2、查看状态

    systemctl status mysql

    3、修改root权限,默认是localhost

    mysql -u root -p

    mysql> use mysql
    mysql> update user set Host="%" where User="root";
    mysql> flush privileges;
    mysql> select Host,User from user;

    4、查看设置的字符集

    mysql> show variables like "%character%";show variables like "%collation%";

     

    本文参考自:https://www.cnblogs.com/yoyotl/p/8057055.html

     

  • 相关阅读:
    Win32程序支持命令行参数的做法
    打包jar类库与使用jar类库
    Java日期格式化
    集合类层次结构关系
    深入理解Arrays.sort()
    Java 异常类层次结构
    equals()与hashCode()方法协作约定
    shp数据和tab数据的两点区别
    java+上传文件夹
    vue+大文件分片上传
  • 原文地址:https://www.cnblogs.com/opsprobe/p/13528569.html
Copyright © 2011-2022 走看看