码迷,mamicode.com
首页 > 数据库 > 详细

mysql学习

时间:2017-04-29 23:30:18      阅读:323      评论:0      收藏:0      [点我收藏+]

标签:license   ges   line   修改   resource   tin   nobackup   权限   提示   

一、开启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.156IDENTIFIED BY 123.com WITH GRANT OPTION; 
   mysql>FLUSH RIVILEGES 
   使修改生效,就可以了 
  
  2、mysql>GRANT ALL PRIVILEGES ON *.* TO root@%WITH GRANT OPTION 
  //赋予任何主机访问数据的权限 
   mysql>FLUSH PRIVILEGES 
  //修改生效 

 

mysql学习

标签:license   ges   line   修改   resource   tin   nobackup   权限   提示   

原文地址:http://www.cnblogs.com/menglingqian/p/6786395.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!