1、wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm // 下载mysql yum源 2、rpm -ivh mysql57-community-release-el7-11.noarch.rpm // 安装yum源 3、yum install mysql-community-server //安装Mysql—Server 4、service mysqld start //启动Mysql 5、grep 'temporary password' /var/log/mysqld.log //获取mysql临时密码 6、mysql -u root -p //登录MYSQL 7、输入临时密码 8、set global validate_password_policy=0; //修改密码复杂度 9、 set global validate_password_length=1; //修改密码长度 10、ALTER USER 'root'@'localhost' IDENTIFIED BY '密码'; //修改密码 11、GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION; //开启远程访问 12、FLUSH PRIVILEGES; //刷新立即生效
Z-blog:www.361wx.com