mysql appends my domain to my username - mysql

I'm trying to access a mysql server remotely, I have all the login details but whenever I try to connect, it always adds my current IP or domain to the username, thus preventing me to login. Furthermore, I don't have terminal access to the server.
From the command line I try something like:
mysql -h example.com -u the_username -p
It returns with the error:
ERROR 1045 (28000): Access denied for user 'the_username'#'my_isp_address.com'
trying:
mysql -h example.com -u the_username#example.com -p
doesn't make a difference, it just returns:
ERROR 1045 (28000): Access denied for user 'the_username#example.com'#'my_isp_address.com'
How can I get through this?

That's how MySql works, you have to specify domain(or ip address) for your records.
If you want to use IP addresses, you will need to enable --skip-name-resolve poperty
More info here DNS Lookup Optimization and the Host Cache
Another option grant access for all hosts for user:
GRANT SELECT ON `db`.`table` TO 'user_name'#'%'
Use (%) sign.
But if you don't have access to server or DB, you will have to find server/db administrator, to configure it for you.

Related

MySQl log in issue when changing #localhost to IP address

I created a user called 'test1' with all all the privileges, but I changed the host name to be my ip address instead of localhost. I was able to login and create a connection using MySQL WorkBench just fine. However I can not login using terminal because it adds #localhost by default each time I try to login. As you can see the below error, it is adding #'localhost' by default. Am I doing something wrong here? FYi, I am doing all the logging on my local machine and my password is correct since I use using workbench just as fine.
mysql -u 'test1'#'xxx.xxx.x.xx' -p (login command)
ERROR 1045 (28000): Access denied for user 'test1#xxx.xxx.x.xx'#'localhost' (using password: YES)
Here is the correct way of login command when one has a user with host name other than localhost.
mysql -h xxx.xxx.x.xx -u test1 -p

Cannot connect to mysql datavbase ERROR Access denied for user... (using password: YES)

Running a php script or trying to connect via terminal (locally) I get the same error
Access denied for user... (using password: YES)
mysql -u username -p'password' -h ip db_name
It passes to the server but get's blocked because of password although correct value was provided.
I've tried several fixes associated to this scenario but to no avail.
When a tried to execute some queries which could provide extra info for the fix, I get
1142 - SELECT command denied to user ... for table 'user'
I've assigned username, password and all privileges in cPanel MySql databases section (for the database) but am unable to connect using the created user as if a root user is blocking access to the database.
Am on GoDaddy host.
These are the only actions that I can preform on my database

Mysql - Unable to enable remote access

I'm having trouble logging in remotely to mysql.
I've set up a user (open_user) without a password and I want to be able to connect with it to my db (open_db) from any remote server (yes I know its a security nightmare but I'm testing something out).
I can log in successfully from the local server:
mysql -openuser open_db
And when I view the grants for this user:
show grants for openuser
- I get this:
GRANT USAGE ON *.* TO 'openuser'#'%'
GRANT ALL PRIVILEGES ON `open_db`.* TO 'openuser'#'%'
My understanding is that this user should be able to log in from any server.
However when I try this:
mysql -uopenuser -hmyserver open_db
I get this:
ERROR 1045 (28000): Access denied for user 'openuser'#'xxx.xxx.xxx.xxx' (using password: NO)
I've also tried setting bind-address in /etc/mysql/my.cnf:
bind-address = 0.0.0.0
Any ideas?
Follow this steps
Open Database Users for MySQL
Edit your user(openuser)
Write to Host %
This will give permission for all IP address for your user.
you can use this,
mysql -h host -u username -p password

MySQL console: change user host in conncetion string

I'm trying to connect to the MySQL database using MySQL console.
MySQL has user: test#% without password.
When i'm trying to connect:
mysql -u test -h 127.0.0.1
I got error:
ERROR 1045 (28000): Access denied for user 'test'#'localhost' (using password: NO)
How i can change user 'test'#'localhost' to 'test#%'?
MySQL has a bit strange logic about the placeholder host, i.e. permissions for the host %. (I'm not sure if "placeholder host" is the correct official name for this.) Namely, the placeholder host does not capture localhost. This can be a bit counter-intuitive.
To be able to log in you will therefore either have to connect from a remote IP (i.e. another computer) or have to grant permissions to test#localhost.

Problems connecting to remote MySQL database

When I try to connect to a remote mysql database I receive an error saying I was unable to log into my router's mysql database.
tom#main:~$ mysql -u appleton -p -h 85.17.xxx.xx
Enter password:
ERROR 1045 (28000): Access denied for user 'appleton'#'85.210.169.xxx' (using password: NO)
Even though I am specifying my IP (85.17.xxx.xx) in the argv the error message is showing my Router's external IP (85.210.169.xxx)
I discovered this whilst using DBI->connect in perl.
Am I missing something obvious?
'appleton'#'85.210.169.xxx' is supposed to show your host, not the database's host. It's your full identifier (username#host) for mysql to determine if you are allowed to connect. Do you have sufficient rights to connect to the database from your IP? Access can be granted to users so that they can only connect from localhost for example.
MySQL Docs on Users