I am able to connect to mysql through a gui workbench but when i try to connect with my applications datasource (which runs on tomcat) i get:
Access denied for user 'dbuser'#'192.168.100.231' (using password: YES)
i have tried all the options in the mysql reference guide but none worked.
any ideas?
You should grant access to remote machine. Connect to MySql as root and do this:
GRANT ALL PRIVILEGES ON *.* TO 'USERNAME'#'IP' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
Instead of IP you may use host you remote machine.
Related
I created an EC2 instance and installed mySQL in it.
Then, I ran the following commands...
create user 'developer'#'%' identified by 'password';
grant all privileges on *.* to 'developer'#'%' with grant option;
flush privileges;
Then, I created a connection to the remote mySQL server from MySQL workbench installed on my local system. Connection was successful.
Then, to connect my spring boot application to the remote mySQL server I changed the configuration in the 'application.properties' file as shown below -
spring.datasource.url=jdbc:mysql://localhost:3306/exam?serverTimezone=UTC
spring.datasource.username=developer
spring.datasource.password=password
But then when I tried to run the application, it showed the following -
Access denied for user 'developer'#'localhost' (using password: YES)
I searched for a solution on stackoverflow and one of the answers said '%' does not include 'localhost' and that a separate user should be created for localhost.
Hence, I created another user 'developer'#'localhost' with same privileges but still the issue remains unsolved.
Could not able to connect to the remote mysql server using mysql workbench or direct command line.
When trying it resolves different hostname
When trying directly through command line
mysql --host=10.37.1.92 --port=3306 --user=root --password=password
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'#'myaapvm.local' (using password: YES)
Tried, with password and without password, no luck.
I tried to connect to 10.37.1.92 server but my mysql client try to connect to different server. The only way I can try now is directly login to the machine and do the change in my DB. I have disabled firewall in my mysql DB. Does anyone faced this issue please help.
This server running with maria DB installation.
By default root is not allowed to access the database by using a remote connection. I recommend that you create a new user that will be used for remote connections. You can do that by using the following SQL commands:
CREATE USER 'myuser'#'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'#'%' IDENTIFIED BY 'mypass';
GRANT ALL ON *.* TO 'myuser'#'localhost';
GRANT ALL ON *.* TO 'myuser'#'%';
FLUSH PRIVILEGES;
You also need to modify your my.cnf if you didn't do that already.
#Replace xxx with your IP Address
bind-address = xxx.xxx.xxx.xxx
I actually thought I could do this until I tried. I installed MySQL server on one PC in the Local network IP Address (192.168.1.4) and now I am trying to access it from another PC in the same network (192.168.1.5) but I am unable:
C:\Users\DOMICO>mysql -u domico -h 192.168.1.4 -p
Enter password: **********
ERROR 1045 (28000): Access denied for user 'domico'#'DOMICO-PC' (using password:
YES)
Surprisingly DOMICO-PC is the PC I am trying to connect from. Why is it not connecting to the given host but trying to connect to Local machine?
You need to give permissions to connect from remotehost
mysql>GRANT ALL PRIVILEGES ON database.* TO 'username'#'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
You need to have proper permissions to connect. In the computer that has the DB installed, give your user the proper permissions:
mysql>GRANT ALL PRIVILEGES ON *.* TO 'domico'#'DOMICO-PC';
mysql>FLUSH PRIVILEGES;
You can read more here:
https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql
And here:
https://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html
This is connecting to the intended host as you require it to. t is just stating who is connecting. and where from.
USER#DOMAIN
user : your user running the mysql command
domain : name of the system you are connecting from.
Log into mysql via the server using -u root, ensure the user 'domico' is created and has sufficient access.
creata a new user by mysql server
and give it privileges you can do it by command and by using any server e.g by using workbench
For all users and all host.
mysql -u root -p
GRANT ALL PRIVILEGES
ON *.*
TO '%'#'%'
IDENTIFIED BY 'password'
WITH GRANT OPTION;
FLUSH PRIVILEGES;
QUIT;
I want to connect to my SQL Server on my remote server. I have installed MySQL on this server with apt-get and set up all necessary details. On the server everything works fine. When I want to connect with the MySQL Workbench, I cannot connect with any user at all.
I logged into MySQL in Ubuntu and created a new user first:
CREATE USER 'username'#'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'#'localhost' WITH GRANT OPTION;
CREATE USER 'username'#'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'#'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
I opened the my.cnf file:
port 3306
bind-address 127.0.0.01 (DO I NEED HERE MY REMOTE SERVER IP?)
service mysql restart
My questions would be:
1) why is the host 127.0.0.1 on my remote server?
2) In the workbench connection setup: which hostname is correct? my server IP or 127.0.0.1
3)I get the message: Failed to connect to MySQL. Access denied. So I think the user is the issue?
4) Do I need to change the cnf?
Thank you.
After you create the user and configure the right permission did you
FLUSH PRIVILEGES;
After you change your my.cnf did you restart Mysql?
Stop and Start from XAMPP Panel control
Change
bind address=127.0.0.1
to
bind-address=YOUR-SERVER-IP
I have a software which communicate with a remote mysql server. After updating the mysql on the remote host I get
2014-07-04 10:11:39.8750Access denied for user 'xxx'#'xxxxxx' (using password: YES)
When I try to connect to the remote mysql from the computer that running the software with the same user and pass there is no problem to connect.
Any ideas?
You have to configure the user ACL. Probably your user currently can access to db only from localhost. You have to grant access from the remote machine client IP.
Example:
GRANT ALL PRIVILEGES ON *.* TO 'user'#'%'
for all privileges from all ip addresses. You can also replace the '%' with you remote machine IP