一、安裝依賴關係mysql
yum -y install openssl-devel yum install perl-JSON
二、安裝mysql(要一塊兒安裝)sql
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
三、查看密碼 數據庫
grep 'temporary password' /var/log/mysqld.log
ide
四、登錄後從新設置root密碼 加密
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Fan2018!';
code
五、建立用戶server
CREATE USER 'fangx'@'%' IDENTIFIED WITH mysql_native_password BY 'Fan2018!'; #(須要注意:mysql8.0加密方式修改了) #檢查用戶 select user, host, plugin, authentication_string from user\G;
六、受權遠程數據庫ssl
#受權全部權限 GRANT ALL PRIVILEGES ON *.* TO 'fangx'@'%'; #受權基本的查詢修改權限,按需求設置 GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON *.* TO 'fangx'@'%';
七、查看用戶權限show grants for 'fangx'@'%';
openssl