• CentOS安装mysql8


    MySQL 是一个流行的开源关系型数据库管理系统,它是由瑞典 MySQL AB 公司创建的,之后被 Sun Microsystems 收购,现在是 Oracle 公司的一部分。MySQL 使用了多种不同的编程语言(包括 C、C++、Python 和 PHP)进行开发,它被广泛用于网站开发和其他应用程序中。MySQL 以其高性能、可靠性和易用性而闻名,并且可以在 Linux、Unix 和 Windows 等多个操作系统上运行。

    添加mysql源

    1. cat > /etc/yum.repos.d/mysql-community.repo << EOF
    2. [mysql-connectors-community]
    3. name=MySQL Connectors Community
    4. baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-connectors-community-el7-\$basearch/
    5. enabled=1
    6. gpgcheck=1
    7. gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
    8. [mysql-tools-community]
    9. name=MySQL Tools Community
    10. baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-tools-community-el7-\$basearch/
    11. enabled=1
    12. gpgcheck=1
    13. gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
    14. [mysql-8.0-community]
    15. name=MySQL 8.0 Community Server
    16. baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-8.0-community-el7-\$basearch/
    17. enabled=1
    18. gpgcheck=1
    19. gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
    20. EOF

    重新导入 MySQL 8.0 Community Server 的 GPG 密钥

    rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
    

    安装 MySQL

    yum install mysql-community-server

    运行 MySQL

    systemctl start mysqld

    获取密码

    grep 'password' /var/log/mysqld.log

    登陆 MySQL

    输入密码 

    mysql -uroot -p

    修改密码

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPwd520@';

    注意:密码至少要有一个大写字母,一个小写字母,一个数字,一个特殊符号,并且长度至少为八位。 

    开放远程连接

    1. use mysql;
    2. update user set Host = '%' where Host = 'localhost' and User='root';
    3. flush privileges;

  • 相关阅读:
    Python自学教程8-数据类型有哪些注意事项
    [Ansible专栏]Ansible Playbook介绍和使用
    Git 开源的版本控制系统-04-branch manage 分支管理
    vue.js axios 数据不刷新
    【算法练习】数组操作
    Java-对象的构造及初始化
    Ubuntu gnome WhiteSur-gtk-theme类mac主题正确安装和卸载方式
    什么是程序化交易
    windows系统服务管理命令sc
    笔试强训(一)
  • 原文地址:https://blog.csdn.net/qq_63431773/article/details/133780663