一、开启mysql远程访问权限,允许连接
[[email protected] 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 //修改生效
时间: 2024-10-12 02:12:45