zoukankan      html  css  js  c++  java
  • mysql学习

    一、开启mysql远程访问权限,允许连接

    [root@test mysql]# innobackupex --host=192.168.1.156   --user=root --password=123.com --defaults-file=/etc/my.cnf --database='test' /opt/backup/
    
    InnoDB Backup Utility v1.5.1-xtrabackup; Copyright 2003, 2009 Innobase Oy
    and Percona LLC and/or its affiliates 2009-2013.  All Rights Reserved.
    
    This software is published under
    the GNU GENERAL PUBLIC LICENSE Version 2, June 1991.
    
    Get the latest version of Percona XtraBackup, documentation, and help resources:
    http://www.percona.com/xb/p
    
    170429 21:06:46  innobackupex: Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_file=/etc/my.cnf;mysql_read_default_group=xtrabackup;host=192.168.1.156' as 'root'  (using password: YES).
    innobackupex: got a fatal error with the following stacktrace: at /usr/bin/innobackupex line 3003
        main::mysql_connect('abort_on_error', 1) called at /usr/bin/innobackupex line 1539
    innobackupex: Error: Failed to connect to MySQL server: DBI connect(';mysql_read_default_file=/etc/my.cnf;mysql_read_default_group=xtrabackup;host=192.168.1.156','root',...) failed: Access denied for user 'root'@'192.168.1.156' (using password: YES) at /usr/bin/innobackupex line 2987

    错误提示:请求被拒接,说明是root账号有问题。

    解决办法:发现是mysql的问题,开启root在mysql中的远程访问权限。

      1.授权法。例如,你想root使用123.com从任何主机连接到mysql服务器的话。 
       mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123.com' WITH GRANT OPTION; 
       如果你想允许用户root从ip为192.168.1.156的主机连接到mysql服务器,并使用123.com作为密码 
       mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.156'IDENTIFIED BY '123.com' WITH GRANT OPTION; 
       mysql>FLUSH RIVILEGES 
       使修改生效,就可以了 
      
      2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION 
      //赋予任何主机访问数据的权限 
       mysql>FLUSH PRIVILEGES 
      //修改生效 
  • 相关阅读:
    多层次子查询的sql执行顺序的问题
    RestTemplate不落地中转文件
    Gitbook从安装到使用【转】
    Linux离线安装依赖包技巧
    CentOS7 配置环境变量断开ssh后失效
    分页查询排序问题
    地图坐标的转换
    FeatureLayer图层的属性查询方式(query的使用方法)
    使用LayerView.effect进行点的高亮显示
    DQL + 排序
  • 原文地址:https://www.cnblogs.com/menglingqian/p/6786395.html
Copyright © 2011-2022 走看看