zoukankan      html  css  js  c++  java
  • 云服务器ECS-yum-mysql--安装mysql 8.0.11

    一、使用yum安装mysql8.0.11:

    1.下载mysql yum源:

      wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

    2.安装yum源:

      yum localinstall mysql80-community-release-el7-1.noarch.rpm

    3.更新yum源:

      yum clean all       yum makecache

    4.创建mysql账户:

      groupadd mysql

      useradd -g mysql mysql

    5.安装mysql:

      yum install mysql-community-server

      (到这一步:)

    6.启动Mysql:

      systemctl start mysqld

    7.查看原始密码:

      cat /var/log/mysqld.log | grep password

          (如果查不到,执行 : vim /etc/my.cnf,

        在pid 开头的下面一行加入下面这句 :  skip-grant-tables,

        重新启动服务:service mysqld restart ,

       然后登陆,直接回车:mysql -u root -p

      )

    8.修改密码:

    1)先将默认的root密码置空:

      use mysql;  

      update user set authentication_string='' where user='root'; (这种修改密码,需要刷新,flush privileges;  authentication_string为''

    2)然后退出,修改my.cnf,重启服务,登录:

      quit

      vim /etc/my.cnf   注释 #skip-grant-tables

      service mysqld restart

      mysql -u root -p

    3) 修改密码:

          alter user 'root'@'localhost' identified by '@FSlwy04201207';(不需要刷新)

       (有时候密码安全等级低,不通过的)

    二、window远程连接linux上的数据库:

    1、防火墙关与不关都可以的!但是必须加端口8080!!!

      1)  开启/关闭防火墙:systemctl start/stop firewalld

      2)添加8080端口:firewall-cmd --zone=public --add-port=8080/tcp --permanent (--permanent永久生效,没有此参数重启后失效)

      3)  重新加载防火墙规则:firewall-cmd --reload

      4)  查看端口:firewall-cmd --zone=public --query-port=8080/tcp

      5)  查看所有的端口:firewall-cmd --zone=public --list-ports

    2、必须要在配置规则:

     

    3、报错1251;原因是MySQL8.0版本的加密方式和MySQL5.0的不一样,连接会报错。

      1) 切换数据库:use mysql

      2)更改加密方式:alter user 'root'@'localhost' identified by 'FSlwy04201207@' password expire never;

      3) 修改密码:alter user 'root'@'localhost' identified with mysql_native_password by '123456';(这种方式修改密码也可以的额,不需要刷新)

      4) 刷新:flush privileges;(这里刷新主要针对更改加密方式,改密码不需要的!!!)

    琐碎知识:

    1、创建数据库:create database meetroom

    2、显示所有数据库:show databases;

    3、使用数据库:use meetroom

    4、创建表:      create table name(     id int auto_increment not null primary key ,            uname char(8),        gender char(2),         birthday date

            );

    5、查看mysql数据库的user表三个属性:

    select user,host, authentication_string from user;

  • 相关阅读:
    断点续传的原理
    中国无线音乐搜索综合测评结果
    从头开始学jsp
    SQLServer和Oracle常用函数对比
    Asp.net程序重启自己
    What Can I do if "The type initializer for 'Emgu.CV.CvInvoke' threw an exception"?
    C++Builder2010多线程调用WebService的问题
    Desmon and Penny
    C#显示摄像头预览
    甲骨文78亿美金并购全球第二芯片商AMD
  • 原文地址:https://www.cnblogs.com/fangsheng/p/10309068.html
Copyright © 2011-2022 走看看