zoukankan      html  css  js  c++  java
  • 部署-MySql 之Linux篇

    1. 配置源

    $ rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
    

    2.  安装 MySQL 8 Community Server

    $ sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo
    $ yum --enablerepo=mysql80-community install mysql-community-server
    

      

    3. 启动

    $ service mysqld start
    

      

    4. 修改密码

    $ grep "A temporary password" /var/log/mysqld.log
    

      修改密码策略

    $ mysql> -u root -p
    $ mysql> set global validate_password.policy=0;
    $ mysql> set global validate_password.length=4; 

       修改root临时密码

    $ mysql_secure_installation
      # Enter password for user root: 临时密码
      # New password: abc@123
      # Re-enter new password: abc@123
      # Remove anonymous users? y
      # Disallow root login remotely? y
      # Remove test database and access to it? y
      # Reload privilege tables now? y
    

      

    5. 设置开机启动

    $ chkconfig mysqld on
    

      

    6. 添加账号并设置远程访问

    $ mysql -u root -p
      # Enter password: abc@123
    mysql> use mysql;
    mysql> create user 'sa'@'%' identified by 'abc@123';
    mysql> GRANT ALL ON *.* TO 'sa'@'%' WITH GRANT OPTION;
    mysql> flush privileges;
    

      

    7.  重启

    $ service mysqld restart
    

      

  • 相关阅读:
    noi.ac 集合
    NOI2019 SX 模拟赛 no.5
    带花树草解
    UR#13 SRAND
    【51nod1847】 奇怪的数学题
    ●POJ 3237 Tree
    ●BZOJ 2049 [Sdoi2008]Cave洞穴勘测
    ●BZOJ 2002 [Hnoi2010]Bounce 弹飞绵羊
    ●POJ 2983 Is the Information Reliable?
    ●POJ 3378 Crazy Thairs
  • 原文地址:https://www.cnblogs.com/ctfyfd/p/13725285.html
Copyright © 2011-2022 走看看