• Centos7在线安装MySQL


    wget dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
    yum localinstall mysql57-community-release-el7-7.noarch.rpm

    yum方式安装:
    yum install mysql-community-server

    使用tar包安装:https://www.jianshu.com/p/276d59cbc529

     登录成功后更新root用户密码:ALTER USER root@localhost IDENTIFIED  BY '123456';

    贴一下/etc/my.cnf:

    [mysqld]
    datadir=/usr/local/mysql/data
    socket=/usr/local/mysql/data/mysql.sock
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    # Settings user and group are ignored when systemd is used.
    # If you need to run mysqld under a different user or group,
    # customize your systemd unit file for mariadb according to the
    # instructions in http://fedoraproject.org/wiki/Systemd
    
    [client]
    port=3306
    socket=/usr/local/mysql/data/mysql.sock
    
    [mysqld_safe]
    log-error=/usr/local/mysql/data/error.log
    pid-file=/usr/local/mysql/data/run/mysql.pid
    
    #
    # include all files from the config directory
    #
    !includedir /etc/my.cnf.d

    /etc/my.cnf.d/mysql-clients.cnf:
    #
    # These groups are read by MariaDB command-line tools
    # Use it for options that affect only one utility
    #
    
    [mysql]
    
    [mysql_upgrade]
    
    [mysqladmin]
    
    [mysqlbinlog]
    
    [mysqlcheck]
    
    [mysqldump]
    
    [mysqlimport]
    
    [mysqlshow]
    
    [mysqlslap]

    安装完成启动时报错:

    Starting mysqld (via systemctl): Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.]
    使用: journalctl -xe命令查看时:
    SELinux is preventing /usr/sbin/mysqld from write access on the directory . For complete SELinux mes

    解决办法:

    1、/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态
    SELinux status:                 enabled
    
    2、getenforce                 ##也可以用这个命令检查

    关闭SELinux:

    1、临时关闭(不用重启机器):
    
    
    复制代码代码如下:
    
    setenforce 0 #设置SELinux 成为permissive模式
    #setenforce 1 设置SELinux 成为enforcing模式
    2、修改配置文件需要重启机器:
    
    修改/etc/selinux/config 文件
    
    将SELINUX=enforcing改为SELINUX=disabled
    
    重启机器即可

     修改root用户密码时报错:

    mysqladmin: [Warning] Using a password on the command line interface can be insecure.
    Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
    mysqladmin: unable to change password; error: 'Column count of mysql.user is wrong. Expected 45, found 43. Created with MySQL 50638, now running 50722. Please use mysql_upgrade to fix this error.'

    解决办法:使用如下命令

    mysql_upgrade

    再次使用命令修改密码:

    /usr/bin/mysqladmin -u root password 'root'

    修改成功。

    唯有热爱方能抵御岁月漫长。
  • 相关阅读:
    keepAliveTime为0以及队列太小导致ThreadPoolExecutor不断创建新线程
    Python str方法
    Python 复制与赋值
    Python 使用pypi镜像源加速第三方库在线安装
    Python ez_setup.py安装错误
    Tools psr
    Python 列表生成试中的if,if else
    Python 执行方法shift+enter
    Python
    DOS 切换文件夹
  • 原文地址:https://www.cnblogs.com/syq816/p/9051041.html
Copyright © 2020-2023  润新知