美文网首页
centos7安装mysql及配置

centos7安装mysql及配置

作者: 奋斗_登 | 来源:发表于2019-02-28 18:53 被阅读0次
    官网下载最新版本的mysql (community版本)
    1. 官网地址:https://dev.mysql.com/downloads
    2. 下载&安装
    wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
    rpm -ivh mysql57-community-release-el7-11.noarch.rpm
    yum update
    yum install mysql-server 
    
    3. 权限设置
    chown mysql:mysql -R /var/lib/mysql
    
    4. 初始化 MySQL
    mysqld --initialize
    
    5. 启动 MySQL:
    systemctl start mysqld
    

    发现启动失败



    查看错误日志 /var/log/mysqld.log


    2019-02-28T11:57:34.064645Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2019-02-28T11:57:34.066491Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.25) starting as process 3021 ...
    2019-02-28T11:57:34.069638Z 0 [Note] InnoDB: PUNCH HOLE support available
    2019-02-28T11:57:34.069668Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2019-02-28T11:57:34.069673Z 0 [Note] InnoDB: Uses event mutexes
    2019-02-28T11:57:34.069676Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
    2019-02-28T11:57:34.069680Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2019-02-28T11:57:34.069683Z 0 [Note] InnoDB: Using Linux native AIO
    2019-02-28T11:57:34.069954Z 0 [Note] InnoDB: Number of pools: 1
    2019-02-28T11:57:34.070075Z 0 [Note] InnoDB: Using CPU crc32 instructions
    2019-02-28T11:57:34.071616Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
    2019-02-28T11:57:34.079929Z 0 [Note] InnoDB: Completed initialization of buffer pool
    2019-02-28T11:57:34.082097Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
    2019-02-28T11:57:34.092128Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
    2019-02-28T11:57:34.092142Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
    2019-02-28T11:57:34.092149Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
    2019-02-28T11:57:34.692583Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
    2019-02-28T11:57:34.692619Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    2019-02-28T11:57:34.692625Z 0 [ERROR] Failed to initialize builtin plugins.
    2019-02-28T11:57:34.692629Z 0 [ERROR] Aborting
    

    解决:

    chmod -R 777 /var/lib/mysql
    
    6. 查看 MySQL 运行状态
    systemctl status mysqld
    
    7. 验证 MySQL 安装
     mysqladmin --version
    
    7. 使用 MySQL Client
    mysql #发现登陆需要密码
    
    grep 'temporary password' /var/log/mysqld.log #找不到
    #删除原来安装过的mysql残留的数据
    rm -rf /var/lib/mysql
    
    mysql -p 
    
    set password=password("123456"); #密码要复杂些,否则不通过
    

    至此mysql已经安装完毕!

    相关文章

      网友评论

          本文标题:centos7安装mysql及配置

          本文链接:https://www.haomeiwen.com/subject/fxvkuqtx.html