• 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 
      //修改生效 
  • 相关阅读:
    搭建一个redis高可用系统
    从“如何设计用户超过1亿的应用”说起----数据库调优实战
    单表60亿记录等大数据场景的MySQL优化和运维之道 | 高可用架构
    信息安全系统和安全体系
    敏捷开发系列之旅 第五站(不一样的RUP统一软件开发过程)
    微服务理论与实践(三)-微服务架构的基本能力和优缺点
    学习“CC攻击”
    查看IIS错误日志
    ISNULL函数
    IE6/7下Select控件Display属性无效解决办法
  • 原文地址:https://www.cnblogs.com/menglingqian/p/6786395.html
Copyright © 2020-2023  润新知