MySQL环境配置搭建

环境

OS

RHEL7.2

步骤

1、安装mysql,详细见mysql官网

2、启动mysql service

rhel7.2中,使用service mysqld start启动mysql服务。【status:查服务状态;stop:停止服务;restart:重启服务】

3、修改root密码

  • 首先使客户端登陆掉过密码检测,然后重启mysql服务
    echo "skip-grant-tables" >> /etc/my.cnf

  • 使用mysql -uroot -p登陆,然后修改mysql库中的user
    update user set password_expired="N" where user="root";
    update user set authentication_string=password("hnagroup") where user="root";

  • 最后删除/etc/my.cnf中的skip-grant-tables,去掉客户端跳过密码检测设置