I'm trying to use the mysqldbcompare tool but getting a connection error:
$ mysqldbcompare --server1=client --skip-data-check db1:db2
# server1 on <ip>: ...
ERROR: Access denied for user 'root'#'<ip>' (using password: YES)
I can use mysql and connect just fine, though. I setup my creds using mysql_config_editor --host=<ip> --user=root --port=3306 --password and tested with the mysql command with and without passing all the args (mysql -u root -p -h <ip> -P 3306).
I've checked the bind address of the server and looked in the server error logs but it just reiterates a connection refused message. I've searched online (and on SO) but haven't been able to find anything.
Any help is appreciated.
When you encountered an access denied error it means the TCP connection has been established, but the password you provided is wrong for'User'#'Host'(a User-Host pair is a real account for MySQL authentication, not a single username).
Assume that MySQL server runs on 172.0.0.8 and your local address is 172.0.0.5.
Take a look at mysql.user by: SELECT * FROM mysql.user\G;. If you can't find either of these two User-Host pairs: 'root'#'172.0.0.5' and 'root'#'%', it means there is no such account. So you failed.
Also check the password of the existed User-Host pair from the output above.
Now, the connection is fine, the account exists, the password is right, the only chance for such an error is: mysqldbcompare didn't use the arguments you provided!
Try other workaround like: mysqldbcompare --server1=root:password#172.0.0.8:3306 --skip-data-check db1:db2
Check all these stuff step by step, and you will figure it out.
I think this command of mysql compare don´t use the default config, try to force the user and password into the command line.
Related
I have two users set up, one is testuser#localhost and one is testuser#111.111.11.111 for example. When I do the following command from ubuntu 20.04 prompt:
mysql -u testuser -p it prompts me for a password and logs me on to testuser#localhost. If I try something like mysql -u 'testuser'#'111.111.11.111' -p it assumes it is localhost and gives an error message Access denied for user 'testuser#111.111.11.111'#'localhost'. How do I specify and log on as a non localhost user?
I found the command, it is mysql -h 111.111.11.111 -u testuser -p. For some reason I am not able to logon with the user with the ip address specified. I keep getting a 2003 error which indicates some kind of configuration issue. Can't connect to MySQL server on ' server ' (10061) indicates that the network connection has been refused.
Let me edit this to make more sense in what I am trying to do. Eventually there will be two mysql servers, say one on ip address 111.111.11.111 and one on 111.111.11.112 for example. I want to be able from a php script running on 111.1111.11.111 be able to access data from a table on 111.111.11.112 for example. I am just now first trying to logon to the first server which is running a mysql database using the user name and ip address of the host.
I will post the answer to the original question which is to include a host parameter in the logon command as follows:
mysql -h 111.111.11.111 -u testuser -p
I'm setting up a MySQL database following this tutorial. I installed it and successfully initialized an instance with a root password, but I am having trouble connecting to the instance via command line. When I click on the 'mysql' executable under bin, I get this message
ERROR 1045 (28000): Access denied for user 'hunter'#'localhost' (using password: NO)
and if I try to enter
> mysql -u root -p
in the terminal I get this message
-bash: mysql: Permission denied
It says in the instructions that I should be getting prompted to enter the password for the database, but for some reason it won't let me.
I would suggest first off to try a mysql workbench. You can download it at https://dev.mysql.com/downloads/workbench/ .
It seems that calling mysql from bash is causing issues for you. If you are using a *Nix environment, it could be a permissions issue and you need to set the correct permissions on the mysql binary. However, usually a correct installation should have already done that. See: https://askubuntu.com/questions/229589/how-to-make-a-file-e-g-a-sh-script-executable-so-it-can-be-run-from-a-termi
Secondly, you should use the username root . hunter is not default username.
From the mysql documentation:
How to Reset the Root Password
If you have never assigned a root password for MySQL, the server does not require a password at all for connecting as root. However, this is insecure. For instructions on assigning a password, see Section 2.10.4, “Securing the Initial MySQL Account”.
Reference:
https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
I am trying to connect my gcloud VM to a mySQL instance also on the cloud, and keep getting this errror:
ERROR 2005 (HY000): Unknown MySQL server host '[10.0.0.1]' (0)
I have followed the instructions from google's documentation here https://cloud.google.com/sql/docs/mysql/connect-admin-ip#connect-ssl and have not found any reasons as to why this could be happening after a lot of searching. I have double checked that the static IP of the VM is authorized, and that I have the right IP for the SQL database. I have tried two ways to connect, using these IP addresses and SSL.
mysql --host=[10.0.0.1] --user=root --password=
and
mysql --ssl-ca=server-ca.pem --ssl-cert=client-cert.pem --ssl-
key=client-key.pem --host=[10.0.0.1] --user=root --password=ms
Both return the same error and I am at a loss as to where to look. Has anyone seen this before, or is more experienced in SQL? This is my first time using a SQL database on google cloud...
Thanks!
In the documentation you pointed to, the example" mysql --host=[INSTANCE_IP] --user=root --password is to imply that the "[INSTANCE_IP]" should be substituted for the IP of your MySQL instance. However, in the snippets above it appears, you may have substituted only the inner content of the braces (i.e. [10.0.0.1]), so try re-running your commands without the braces around your IP:
mysql --host=10.0.0.1 --user=root --password
dnt add the semicolon after the connection command like this
---> bin>mysql -u root -p -h localhost;(here) is the semicolon you just need to remove it and try it like this way..
bin>mysql -u root -p -h localhost
I am facing problem in setting mysql replication monitoring using mk-heartbeat.
DBI connect('Heartbeat;host=10.160.251.223;mysql_read_default_group=client','heartbeat',...) failed: Access denied for user 'heartbeat'#'%' to database 'Heartbeat' at /EBSroot/maatkit/mk-heartbeat line 2056
I have created a user heartbeat that has no permissions.
Please refer this document http://www.maatkit.org/doc/mk-heartbeat.html
Also Access denied error is because of invalid credentials. Check MySQL username and password are correct on both server (Master and slave) and run application by referring to documentation provided.
I suggest you use mysql shell command to check if the username or password is ok
for example :
mysql -u heartbeat -p -h 10.160.251.223, and just enter if you don't have password...
by the way, I suggest adding a password for this user for security.
Have a question that I can't seem to find an answer for. I am trying to connect to a remote database. I type in the following to my Ubuntu shell:
mysql -u test -h mysql.domain.com -p
mysql asks for my password and then outputs the following:
ERROR 1045 (28000): Access denied for user 'test'#'externalit.domain.com' (using password: YES)
The problem is that I am not on externalit. I am on a completely different host. I think that the server I am on was cloned from externalit, but I didn't set the server up. My question: does mysql have a conf file or other setting that may be automatically entering an incorrect hostname? Can I change this?
That's the name that the server thinks goes with your IP address. It could be do to a DNS setting (it's trying a reverse-DNS), or something in the /etc/host file (mapping that IP to that host).
You need to make sure the reverse DNS on the machine you are connecting from matches the address for the user.
If you are on a shared IP or can't control the reverse DNS then change the permissions on the user to 'test'#'%' this will allow anyone from any ip address connect as long as they have the correct username/password pair. of course this opens up some security issues.
You can prevent mysql from doing reverse lookups and then use 'test'#'123.123.123' as the user/host but unless you are on a fixed IP that could cause issues.
DC
Try adding a protocol option:
mysql -u test -h mysql.domain.com --protocol=tcp -p
and/or try adding a port explicitly:
mysql -u test -h mysql.domain.com -P3306 --protocol=tcp -p
(see: http://dev.mysql.com/doc/refman/5.1/en/mysql-command-options.html#option_mysql_protocol)