zoukankan      html  css  js  c++  java
  • 阿里云安装MySQL

      下载mysql源安装包:wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm

          安装mysql源:yum localinstall mysql57-community-release-el7-8.noarch.rpm

     

         检测是否安装完成:yum repolist enabled | grep "mysql.*-community.*"

     安装mysql:yum install mysql-community-server

        若结尾出现Complete!, 则MySQL安装完成

     设置开启启动mysql服务:systemctl enable mysqld

     查看安装的mysql版本:rpm -aq | grep -i mysql

     启动MySQL服务:systemctl restart mysqld

     查看MySQL初始密码:grep 'A temporary password' /var/log/mysqld.log

     

     更改MySQL密码:mysqladmin -u root -p'旧密码' password '新密码'

     这里更改密码出了问题,更改失败,这是因为密码太过简单的原因。有两个接解决方法:

     

        方式一:把密码设置复杂点(这是最直接的方法)

     

        方式二:关闭mysql密码强度验证(validate_password)

            编辑配置文件:vim /etc/my.cnf, 增加这么一行validate_password=off

            编辑后重启mysql服务:systemctl restart mysqld

    我直接使用原始密码登录进入后,然后修改密码:

     

    设置mysql能够远程访问:

     

        登录进MySQL:mysql -uroot -p密码

     

         增加一个用户给予访问权限:grant all privileges on *.* to '用户名'@'ip地址' identified by '密码' with grant option; //可将ip改为%%,表示开启所有的

    然后在阿里云控制台开放MySQL端口号:

  • 相关阅读:
    leetcode 29-> Divide Two Integers without using multiplication, division and mod operator
    ros topic 发布一次可能会接收不到数据
    python中的print()、str()和repr()的区别
    python 部分函数
    uiautomatorviewer错误 unable toconnect to adb
    pyqt 不规则形状窗口显示
    appium 计算器demo
    Spring 3.0 注解注入详解
    Spring Autowire自动装配
    restful 学习地址
  • 原文地址:https://www.cnblogs.com/lhd1998/p/13304486.html
Copyright © 2011-2022 走看看