1. # 安装依赖
  2. yum update
  3. yum install ncurses-compat-libs
  4. # 下载安装包
  5. # 可以自行选择下载的版本 https://repo.mysql.com/yum/
  6. wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-libs-5.7.31-1.el7.x86_64.rpm
  7. wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-common-5.7.31-1.el7.x86_64.rpm
  8. wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.31-1.el7.x86_64.rpm
  9. wget https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.31-1.el7.x86_64.rpm
  10. # 安装
  11. rpm -Uvh mysql-community-libs-5.7.31-1.el7.x86_64.rpm
  12. rpm -Uvh mysql-community-common-5.7.31-1.el7.x86_64.rpm
  13. rpm -Uvh mysql-community-client-5.7.31-1.el7.x86_64.rpm
  14. rpm -Uvh mysql-community-server-5.7.31-1.el7.x86_64.rpm
  15. # 启动
  16. systemctl start mysqld
  17. # 查找默认密码
  18. grep 'temporary password' /var/log/mysqld.log
  19. # 使用默认密码登录
  20. mysql -u root -p
  21. # 更改默认密码
  22. set password for 'root'@'localhost' = password('XXXXXXXX');
  23. # 更改密码校验等级
  24. set global validate_password_policy=0;
  25. # 创建新用户密码
  26. create user 'chutianshu'@'%' identified by 'XXXXXXXX';
  27. # 授权
  28. GRANT ALL PRIVILEGES ON *.* TO 'chutianshu'@'%' identified by 'XXXXXXXX';
  29. # 使生效
  30. flush privileges;
  31. # 更改端口
  32. vim /etc/my.cnf
  33. # 在文件中加入
  34. port=63306

来源:https://blog.csdn.net/weixin_42109012/article/details/102684153

分类: web

标签:   mysql