1、安装依赖关系
yum -y install openssl-devel
yum install perl-JSON
2、安装mysql(要一起安装)
rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm
mysql-community-devel-8.0.11-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-8.0.11-1.el7.x86_64.rpm
mysql-community-server-8.0.11-1.el7.x86_64.rpm
mysql-community-client-8.0.11-1.el7.x86_64.rpm
mysql-community-test-8.0.11-1.el7.x86_64.rpm
3、查看密码
grep ‘temporary password‘ /var/log/mysqld.log
4、登陆后重新设置root密码
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘Fan2018!‘;
5、创建用户
CREATE USER ‘fangx‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘Fan2018!‘;
#(需要注意:mysql8.0加密方式修改了)
#检查用户
select user, host, plugin, authentication_string from user\G;
6、授权远程数据库
#授权所有权限
GRANT ALL PRIVILEGES ON *.* TO ‘fangx‘@‘%‘;
#授权基本的查询修改权限,按需求设置
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON *.* TO ‘fangx‘@‘%‘;
7、查看用户权限show grants for ‘fangx‘@‘%‘;
原文地址:http://blog.51cto.com/243662875/2106456
时间: 2024-11-07 18:02:16