yum install mysql5.6 in centos6

查看系统是否自带安装mysql

yum list installed | grep mysql

如果系统自带mysql,那么先卸载

yum -y remove mysql-libs.x86_64

下载安装 yum 源,在/etc/yum.repos.d/ 目录下多出 mysql-community-source.repo 和 mysql-community.repo

wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
rpm -ivh mysql-community-release-el6-5.noarch.rpm

安装mysql 服务,并启动

yum install mysql-community-server -y
service mysqld start

设置 root 密码(第一次登录直接回车,不用输入密码)

mysql -u root;
use mysql;
update user set password=PASSWORD("这里输入root用户密码") where User='root';
flush privileges; 

设置 mysql 开启自启动命令

chkconfig --list | grep mysqld
chkconfig mysqld on

mysql安全设置

mysql_secure_installation
已有 2 条评论
  1. demo

    实用,收下了。

    demo March 20th, 2019 at 01:49 pm回复
    1. LukaChen

      不客气

      LukaChen March 20th, 2019 at 01:50 pm回复
发表新评论