首页 > 代码库 > mysql学习
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 Oyand Percona LLC and/or its affiliates 2009-2013. All Rights Reserved.This software is published underthe GNU GENERAL PUBLIC LICENSE Version 2, June 1991.Get the latest version of Percona XtraBackup, documentation, and help resources:http://www.percona.com/xb/p170429 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 1539innobackupex: 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 //修改生效
mysql学习
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。