centos yum方式安装mysql

一、安装准备

  1. 博客演示系统版本:CentOS Linux release 7.7.1908 (Core)  阿里云服务器
  2. mysql安装文件:网站寻找需要版本http://repo.mysql.com/    博客使用的为:mysql-community-release-el6-5.noarch

二、安装过程

  1. 下载mysql yum 源文件,并解压下载文件
    # wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
    # rpm -ivh mysql-community-release-el6-5.noarch.rpm

  2. 安装数据库(安装时长和网络有关)
    yum repolist all 
    yum install -y mysql-community-server 

  3. 设置开机启动,并启动mysql
    # chkconfig mysqld on
    # service mysqld start

  4. 设置密码、登录和建立root用户
    # mysql_secure_installation
    # mysql -uroot -p 
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '自定义密码' WITH GRANT OPTION;
    mysql> flush privileges;

 

posted @ 2020-03-12 22:04  ASQW234  阅读(68)  评论(0编辑  收藏  举报