zoukankan      html  css  js  c++  java
  • Centos6.8安装Mysql5.7

         1、下载

      wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm

    2、安装用来配置mysql的yum源的rpm包

           rpm -Uvh mysql57-community-release-el6-9.noarch.rpm
         或

           yum localinstall -y mysql57-community-release-el6-9.noarch.rpm

    3.安装mysql
        yum install mysql-community-server

    4.开启mysql服务
        service mysqld start

    5 mysql安装成功后创建的超级用户'root'@'localhost'的密码会被存储在/var/log/mysqld.log,可以使用如下命令查看密码 :  grep 'temporary password' /var/log/mysqld.log

    6、登录 mysql -uroot -p

    7、修改密码: 

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
    8、开启远程连接

    设置iptables开放3306端口 : vi /etc/sysconfig/iptables

    PS 如果使用远程登录失败:

    解决方案:

    将localhost改成%

    进入mysql的BIN目录:
    mysql -u root -p

    mysql>use mysql;

    mysql>

    update user set host='%'where user ='root';

    mysql>flush privileges;


    分析:
    在本机登入mysql后,更改“mysql”数据库里的“user”表里的“host”项,从”localhost”改为'%'。
    mysql>
    mysql>use mysql;
    mysql>select 'host' from user where user='root';


    #查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称)
    mysql>update user set host = '%' where user ='root';
    #修改host值(以通配符%的内容增加主机/IP地址,当然也可以直接增加某个特定IP地址,如果执行update语句时出现ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' 错误,需要select host from user where user = 'root';
    查看一下host是否已经有了%这个值,如果有了直接执行下面的flush privileges;即可)
    mysql>flush privileges;
    mysql>select host,user from user where user='root';
    mysql>quit






  • 相关阅读:
    括号拼接字符串
    递归删除
    ES6实用常用用法
    @RequestBody与@ResponseBody注解
    (node:11224) UnhandledPromiseRejectionWarning: TypeError: this.getResolve is not a function
    npm安装webpack速度太慢解决方法
    Component template requires a root element, rather than just text.
    js操作cookie
    js在函数中发Ajax请求返回undefined问题
    SQL 登录时提示:Server returns invalid timezone. Need to set 'serverTimezone' property.
  • 原文地址:https://www.cnblogs.com/toov5/p/9982623.html
Copyright © 2011-2022 走看看